If Statements

If statements are pretty easy to understand, and are not only used in Lua, but is used in multiple other languages such as C#. If statements are statements that check a value. There are many ways to incorporate a If statement. A example is provided below.

local OwnsCat = true

if OwnsCat == true then
print("They Own A Cat")
end

First, we have a variable that is equal to the bool value of true. Then, we write our if statement which checks if that variable is equal to true. If it is, then it will print "They Own A Cat" If it does not, the if statement will not run. Then, we need to end the if statement using a "end".

Easy Explanation

Lets say I have 1 apple, and my friend says if I have 2 apples I can get a orange. Since I have one apple, I will not receive a orange.

Last updated