What does operator ~= mean in Lua?

The ~= symbol or operator in Lua is known as the not-equal to operator. In many programming languages you might have seen the symbol != which is also known as the not equals operator.

Let’s consider a few examples where we can make use of the not equals operator.

Example

Consider the examples shown below −

a = 2
b = 3
print(a ~= b)

Output

true

Example

t1 = {4,2,3}
t2 = {2,3,4}
print(t1 ~= t2)

Output

true
Updated on: 2026-03-11T22:50:57+05:30

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements