Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Patrol Buster and variables inside an if statement


Why when inside of an if statement is a variable not written like:

var enemy = …?

Im watching the help video on patrol buster in the second campaign and he mentions it and refers to enemy as a variable but not why we write it differently. Thanks for any help!


“var” is used when you create (the first time) a variable.
“enemy = …” is an assignment. enemy = you over there
"if enemy == …" is a question. does enemy mean that one over there? IF so then do something.