Can you help me to understand why the if doesnt work there. I am noob 😂 thank you | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can you help me to understand why the if doesnt work there. I am noob 😂 thank you

https://code.sololearn.com/Wgufele9Cg2h/?ref=app

30th Jul 2020, 11:02 PM
Jérôme Allard
Jérôme Allard - avatar
5 Answers
+ 1
Don't worry, you are here to learn. Just sometimes revise the theory Or look some similar code to check and correct yourself instantly ;)
30th Jul 2020, 11:20 PM
Wally
Wally - avatar
+ 3
== instead of = use = for assignment, like: x = 5 assigns the value 5 to x variable use == for comparison, like: if(x==5) { Do Stuff; }
30th Jul 2020, 11:04 PM
Wally
Wally - avatar
+ 1
Thank you very much. I understand now
30th Jul 2020, 11:09 PM
Jérôme Allard
Jérôme Allard - avatar
+ 1
The = operator is for assigning values ​​to variables, the == operator is for comparing objects. Change the = on line 16 as Wally says to ==
30th Jul 2020, 11:12 PM
Emanuel Maliaño
Emanuel Maliaño - avatar
0
And when i wrote "red" on the input box the first letter is uppercase i doesnt expected this. sorry for my english and thx for the answer
30th Jul 2020, 11:15 PM
Jérôme Allard
Jérôme Allard - avatar