Print is one of the basic functions of Roblox scripting; it is a very simple method with a tuple of parameters. The method shows in the Roblox Studio's output box whatever string is entered in the parameters, or if there is a polynomial within the parameters, whatever the polynomial equals. For example,
print("Hello, world!")
would show in the output:
Hello, world!
But also,
print("Hello","World")
would make
Hello World
Strings vs. Polynomials[]
If you want to output exactly what is typed within your parameter, you enter the text within double quotes within the parentheses, however if you are trying to make RBLX.lua calculate a polynomial, then do not use double quotes, and simply enter your polynomial in the parentheses. As an example:
print("1+1")
--Double quotes cause the entered text to be outputted as-is
would output:
1+1
But
print(1+1)
--No quotes tells the engine that there is a calculation to be performed
would output:
2
Use of Variables[]
Variables can also be inputted into the parameters, for example
a = "Hello World!"
print(a)๏ปฟ
๏ปฟ
would output:
Hello World!
Note that the quotes rule still applies as before, so
a = 1+1
print(a)
would output:
2
In addition...
a = 1
print(5+a)
would output:
6
Usage[]
As the print function does not actually interact with the Workspace service, scripters mainly use this function for debugging to check if and when a certain action in their script has been performed, and, if one of the actions failed, which action in the script failed.
Programming |
| ||||||
---|---|---|---|---|---|---|---|
Design | |||||||
Assets | |||||||
Tools | |||||||
Monetization | |||||||
Analytics | Developer Stats ยท Monthly active users (MAU) | ||||||
Advertising | |||||||
Resources |