Simple Output
To Do
To John: write simple introduction, noting the need/non-need for imports. Give references to more advanced forms of output such as Slang templates.
println
and print
are the simplest methods for output:
println("Hello World!") // print with a newline to stdout
print("a") // print without a newline to stdout
print("b")
print("c")
println(" all done with this line!")
produces the following output
Hello World!
abc all done with this line!
Both methods can take an arbitrary number of arguments:
println("Hey there:","I'm over here.","Wait, I moved over here.")
produces the following output:
Hey there:I'm over here.Wait, I moved over here.
Analogous commands eprintln
and eprint
are used to print to
stderr
. cprintln
and cprint
generalize printing to
stdout
and stderr
accepting a boolean as the first argument
that determines if output will be sent to stdout
(false) or
stderr
(true).
To Do
To Robby: should we address the basic string interpolation in this section?