Not sure why the if statement always takes the condition as False, even if its true | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Not sure why the if statement always takes the condition as False, even if its true

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

17th Oct 2022, 6:57 PM
Visual learner
Visual learner - avatar
4 Answers
+ 1
Also I would advise you to use Equals instead of ==. If you want to know more about the difference you can read this: https://www.tutorialspoint.com/difference-between-and-equals-method-in-chash
17th Oct 2022, 7:12 PM
Tomás Ribeiro
Tomás Ribeiro - avatar
+ 1
You don't want to see if the name is "jake", you want to see if the value is "jake". You just need to change name to value on the condition.
17th Oct 2022, 7:09 PM
Tomás Ribeiro
Tomás Ribeiro - avatar
+ 1
You are checking existing setted value, not setting value. Use if ( value == "jake")
17th Oct 2022, 7:09 PM
Jayakrishna 🇮🇳
+ 1
Ohh thank you guys! Cleared the fog
17th Oct 2022, 7:40 PM
Visual learner
Visual learner - avatar