Why isnt this calculator working? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why isnt this calculator working?

If you put in a calculation(like 1+1,and you have to do a new line for everything)it says that it is invalid!(my program is supposed to detected if the input is right or not and output it)here is the program. https://code.sololearn.com/c6DcZ36Gzd3w/?ref=app

15th Apr 2020, 4:32 PM
Icebreaker
Icebreaker - avatar
3 Answers
+ 2
From your logic of if else statement it shoult be written: var tryagain: Boolean = false;
15th Apr 2020, 5:48 PM
JaScript
JaScript - avatar
+ 1
Your welcome! I would like to recommend you to read more about if else statements etc. You had the boolean variable tryagain assigned. That means it‘s alredy boolean and do not need to write „tryagain == false“. From this reason it should looks like: if(tryagain){ your ... code} else { your code}. Have fun while learning.
15th Apr 2020, 7:38 PM
JaScript
JaScript - avatar
0
Thanks a lot! It worked!
15th Apr 2020, 6:18 PM
Icebreaker
Icebreaker - avatar