== and =

Hi,

In the code we have…

else if (input == "1")
and
level = 1;

Why do we use == on the method and = on the statement?

Hi,

That’s a very good and important question.

= assigns a value to a variable. == compares to values with one another.

Did this clear it up for you?


See also:

Hi Nina,

Oh yes perfect, that makes sense :slight_smile:

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

Privacy & Terms