In this lesson we'll review all the logical operators that are available to use in Lua.Â Â Operators are special expessions that can be used to determine the relationship of two values.Â Â They are often used in "if" statements to execute code when a condition is met.

## Equals

The equals operator is denoted by two equals signs in a row:

**==**The equals operator is a test to see if two values are equal.Â Â This does not assign a value to a variable.

n=2

if n==2 then

Â Â Â Â print("n equals 2")

end

The equals operator can be used with any data type, including strings and boolean values.

name="Fred"

if name=="Fred" then

Â Â Â Â print("The name's Fred")

end

## Less Than

The less than operator determines if one number is smaller than another.Â Â The less than sign looks a little bit like a bird's beak if you picture the bird facing to the left:

**<**Remember, birds don't eat a lot, so the number where his beak points is smaller.Â Â Here's an example of it in action:

a = 1if a < 2 then

print("a is less than 2")

end

## Greater Than

The greater than operator determines if one number is larger than another.Â Â The greater than sign looks a little bit like an alligator's mouth if you picture the alligator facing to the left:

**>**Remember, alligators eat a lot, so the number where his mouth points is bigger.Â Â Here's an example of it in action:

a = 1if a > 0 then

Â Â Â Â print("a is greater than 0")

end

## Less Than or Equal To

This is a variation of the less than operator that will also be true if the values are equal. It is denoted by a less than sign followed by a single equals sign:

**<=**Here is an example of its usage:

a = 1if a <= 1 then

Â Â Â Â print("a is less than or equal to 1")

end

## Greater Than or Equal To

This is a variation of the greater than operator that will also be true if the values are equal.Â Â It is denoted by a greater than sign followed by a single equals sign:

**>=**Here is an example of its usage:

a = 1if a >= 1 then

Â Â Â Â print("a is greater than or equal to 1")

end

## Not Equal

This operator is the opposite of the equals operator.Â Â It is indicated by a tilde character followed by a single equals sign:

**~=**Here is an example of its usage:

a = 1if a ~= 5 then

Â Â Â Â print("a does not equal 5")

end

## Conclusion

You will frequently encounter all of these operators while writing Lua scripts.Â Â Make sure you understand how they all work, and ask on the forum if you have any questions.Â Â You're doing great!