The Crystal Programming Language Forum

Assignment operator and operator equal

Hi everyone :heart: .
I read the documentation, but I still don’t understand if there is an equal operator in Crystal. I used the assignment operator to designate my variables, but for example I need to equalize a variable, how can I do this?
e.g:
if a = 5
if a == 5 ← Could it be in Crystal? I tried to find info, but I couldn’t …
Thanks everyone for the help! :handshake:

a = 5

a # => 5

b = 6

b # => 6

if a == b
  puts "equal"
else
  puts "not equal"
end
# => not equal

Ref: Operators - Crystal and Assignment - Crystal.

2 Likes

Thank you so much! Apparently I missed it in the documentation :handshake: