ProtoLang.net

Reference: Print

☰ Hide Sidebar
TOKEN PRINT
ALIAS None

The Print Command is used to display data on the screen. 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 PRINT:

PRINT VALUE

The long syntax structure uses the word PRINT:

PRINT VALUE

Examples

Example: Printing Literal

PRINT 123 // Displays "123"

Example: Printing Variable

NEW INT x = 123
PRINT x // Displays "123"

Example: Printing Expression

NEW INT x = 123
PRINT x + x // Displays "246"

Example: Printing multiple Variables

NEW INT a = 12
NEW INT b = 34
NEW INT c = 56
PRINT a // Displays "12"
PRINT b // Displays "34" on the same line directly following "12"
PRINT c // Displays "56" on the same line directly following "1234"

Example: Printing multiple Variables using Concatenate operator

NEW INT a = 12
NEW INT b = 34
NEW INT c = 56
PRINT a .. b .. c // Displays "123456"

Common Errors

Error: Printing non-existent Variable

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