Why must i use double = instead of single =


#1


#2

= is an assignment operator
== is an equality operator

When you assign a value to a variable, you do it like this:

my_variable = "hello" // my_variable receives (gets assigned) “hello”

If you want to compare two values, you use ==

s == "yes" // they share the same value


b = 5
c = 10
d = 10
b == c #false because 5 is not equal to 10
c == d #true because 10 is equal to 10

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.