0
This if else statement is a flawless masterpiece but it won't work
Run the code. Press "Continue", then press "Talk to them". Pressing the second button will call a function which will edit a var, and then call another function with an if/else in it. (see first 2 functions) I see 2 ways to solve the issue (see //comments). Though, I'm really curious on why the code written like that won't work. https://code.sololearn.com/Wy9odFDG8l2F
3 Respuestas
+ 4
You redefine the variable "spoken" in each function so that it will be local to that function. Remove the "var"
+ 2
In that case it was flawed.
0
Thanks Anna. So declaring a var again will make a local variable. That's good to know. I always get stuck on the simplest things lol.