Is it safe to rely on condition evaluation order in if statements?

It’s safe to depend on the order of conditionals (Python reference here), specifically because of the problem you point out – it’s very useful to be able to short-circuit evaluation that could cause problems in a string of conditionals.

This sort of code pops up in most languages:

IF exists(variable) AND variable.doSomething()
    THEN ...

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)