if "began" == phase vs. if phase == "began"?

Just curious, most of your sample code puts the constant first in an if statement - e.g.

if “began” == phase

Whereas I’m accustomed to

if phase == “began”

Is this simply a style thing, or is there some performance reason to do it in the order you do? Also, does putting parenthesis around the if test cost anything?

.phil [import]uid: 4366 topic_id: 366 reply_id: 300366[/import]

old programming habits are hard to break :wink:

it is easy to make a mistake and omit the second “=” and could lead to lead to an assignment.

such as

phase = “began” instead of phase == “began” – sometimes the bug as simple as the additional missing “=” could lead you astray for hours.

Best

Carlos [import]uid: 24 topic_id: 366 reply_id: 655[/import]

Oh right. Been caught by that one many times. Good trick to avoid it. Though I noticed Lua generates an error if you make this mistake. [import]uid: 4366 topic_id: 366 reply_id: 659[/import]