Hello world/Newline omission: Difference between revisions
Content added Content deleted
Jazzedpineda (talk | contribs) (Omit Craft Basic) |
(echo() prints with a newline, added code demonstrating print without newline) |
||
Line 510: | Line 510: | ||
=={{header|Fantom}}== |
=={{header|Fantom}}== |
||
<syntaxhighlight lang=" |
<syntaxhighlight lang="java"> |
||
class Main { |
class Main { |
||
Void main() { |
Void main() { |
||
// Print with newline |
|||
echo(" |
echo("Hello, World!") |
||
Env.cur.out.printLine("Hello, World!") |
|||
// Print without a newline |
|||
Env.cur.out.print("Goodbye, world!") |
|||
// Also can get a reference to the standard output stream |
|||
out := Env.cur.out |
|||
out.print("Goodbye, world!") |
|||
out.flush() // and flush buffer if needed |
|||
// or method chain |
|||
out.print("Goodbye, world!").flush() |
|||
} |
} |
||
} |
} |