ProtoLang.net

Reference: PrintLn

☰ Hide Sidebar
TOKEN PRINTLN
ALIAS None

The PrintLn Command is used to display data on the screen. PrintLn works exactly like Print except that PrintLn automatically moves the cursor to the start of the next line after displaying the value. Values can be Literal, Variable or Expression. Multiple values can be printed using the Concatenate operator. Special Note: \n and \t escape sequences are supported but may produce unexpected results.

Syntax

The short syntax structure uses the word PRINTLN:

PRINTLN VALUE

The long syntax structure uses the word PRINTLN:

PRINTLN VALUE

Examples

Example: Printing Literal with new line

PRINTLN 123 // Displays "123" then moves to the next line
PRINTLN 456 // Displays "456" then moves to the next line

Example: Printing Variable with new line

NEW INT x = 123
NEW INT y = 456
PRINTLN x // Displays "123" then moves to the next line
PRINTLN y // Displays "456" then moves to the next line

Example: Printing Expression with new line

NEW INT x = 123
NEW INT y = 456
PRINTLN x + x // Displays "246" then moves to the next line
PRINTLN y + y // Displays "912" then moves to the next line

Example: Printing multiple Variables with new lines

NEW INT a = 12
NEW INT b = 34
NEW INT c = 56
PRINTLN a // Displays "12" then moves to the next line
PRINTLN b // Displays "34" then moves to the next line
PRINTLN c // Displays "56" then moves to the next line

Example: Printing multiple Variables using Concatenate operator

NEW INT a = 12
NEW INT b = 34
NEW INT c = 56
PRINTLN a .. b .. c // Displays "123456" then moves to the next line

Common Errors

Error: Printing non-existent Variable with new line

PRINTLN x // Runtime error! Variable "x" does not exist!
NEW INT x = 5 // This line is not executed because the program crashed!