+ 3
Why isnt my prompt triggering correctly?
https://code.sololearn.com/Wm1XK6xIgmCO/?ref=app I am building a text based choose your own adventure game to practise my skills. Line 11 is where fight choice begins and line 18 is flee choice. I am not sure why but fight choice works correctly but flee choice also prompts fight choice. I am also not sure I am writing flee choice correctly as i want it to return you to left or right choice. The code is commented so hopefully this isnt too confusing.
2 Answers
+ 4
You'Re using a single "=", to evaluate whether two items are the same you should use two.
if(a==b) {}
Or three if you want to compare also the type.
1=="1" //True
1==="1" //False
+ 3
Thank you! Flee is now prompting! Believe it or not i was trying to figure that out for a couple of days. I'm going to have to read up on that.