Printing to the Console
You can "print" or display messages in the console with the following code:
Line of text:
print("Hello!"); Prints:
Hello!
Multiple "strings" of text on ONE line:
print("Hello, ");
print("y'all!");Prints:
Hello, y'all!
Line of text with a carriage return at the end:
println("Hello!"); Prints:
Hello!
Multiple "strings" of texts showing the difference between print() and println()
print("Hello, ");
println("y'all!");
print("I'm happy to see you.");Prints:
Hello, y'all! I'm happy to see you.
You can also "concatenate" or connect strings with a plus (+) sign:
println("Hello, " + "y'all!");
println("I'm happy to" + " see you.");Prints:
Hello, y'all! I'm happy to see you.
Last updated
Was this helpful?