> For the complete documentation index, see [llms.txt](https://pretender.gitbook.io/beginners-scripting-guide-beta/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pretender.gitbook.io/beginners-scripting-guide-beta/basic-global-functions.md).

# Basic global functions

✏ Beginners Scripting Guide ✏

<https://create.roblox.com/docs/reference/engine/globals/LuaGlobals#print>\
<https://create.roblox.com/docs/reference/engine/globals/LuaGlobals#error>\
<https://create.roblox.com/docs/reference/engine/globals/RobloxGlobals#warn>\
<https://create.roblox.com/docs/reference/engine/globals/LuaGlobals#assert>\
\
In this section, we will be discussing global functions. Global functions were the functions that were built-in in Roblox. You can call them by typing their name in the script and call them. In Roblox, we got <mark style="color:blue;">**assert()**</mark>, <mark style="color:blue;">**gcinfo()**</mark>, <mark style="color:blue;">**setmetatables()**</mark> and much more as Roblox built-in functions. But, we are not talking about them now because we are going to be talking about how <mark style="color:blue;">**print()**</mark>, <mark style="color:blue;">**warn()**</mark>, <mark style="color:blue;">**error()**</mark>, and <mark style="color:blue;">**assert()**</mark> and how they work in Roblox.

### PRINT GLOBAL FUNCTION

The <mark style="color:blue;">**print()**</mark> global function can be used to print out the content that was put inside of it into Roblox output. It is very useful when it comes to debugging your code to find what bug caused this glitch or error in your game.

### **WARN GLOBAL FUNCTION**

The <mark style="color:blue;">**warn()**</mark> global function can be used to print out the content that was put inside of it as yellow/orange text into Roblox output. It can be used to get developers' attention so that they can keep track of what their script is doing and adjust a few changes to the script if needed.

### **ERROR GLOBAL FUNCTION**

The <mark style="color:blue;">**error()**</mark> global function can be used to throw an error of the content that was put inside of it to the output. This can be very useful to throw an error in your script so that it prevents other code blocks below from running and bugging your game out.

### **ASSERT GLOBAL FUNCTION**

The <mark style="color:blue;">**assert()**</mark> global function can be used to throw an error just like the <mark style="color:blue;">**error()**</mark> global function. But, it will only throw an error of the content that was put on the second argument when the first argument is <mark style="color:red;">**false**</mark> or <mark style="color:yellow;">**nil**</mark>. It is very useful just like <mark style="color:blue;">**error()**</mark> and it is the shortened version of <mark style="color:blue;">**error()**</mark><mark style="color:blue;">.</mark> It can be used to check if the condition of something is not <mark style="color:yellow;">**nil**</mark> or <mark style="color:red;">**false**</mark> to prevent bugs when running the code below it.
