Printing
The core functions print(value) and println(value) write one value.
println adds one line-feed byte; println() writes only that line feed.
print("Count: ");
println(3);
println();Output:
Count: 3
Neither function inserts spaces, accepts multiple arguments, or interprets
format placeholders. They return void. A local or member named print or
println shadows the corresponding core overload set.
Value representations
| Value | Printed form |
|---|---|
| String | Its UTF-8 bytes unchanged |
| Boolean | true or false |
| Character | Unicode scalar encoded as UTF-8 |
| Integer | Base-10 digits, with a minus sign when negative |
| Finite floating-point | Locale-independent shortest round-trippable decimal |
| Special floating-point | inf, -inf, or nan |
| Class instance | <qualified.TypeName> |
| Array | <Array> |
| Enum | qualified.TypeName.CaseName |
| Struct | <qualified.TypeName> |
| Null literal | null |
Objects do not print addresses or field contents. Struct and enum printing does not box values. Import aliases do not change their qualified output names.
Narrow nullable references before passing them to non-null output overloads.
The bare null literal has its own output support.
String bytes, including embedded zero bytes, are preserved. Native Windows output uses the same line-feed contract as other supported hosts.
User-defined string conversion, interpolation, array-content formatting, and
general formatting APIs are not currently supported. For text concatenation,
both operands of + must be strings.