37
Finoli
8y

if (thing = anotherThing)

I think we've all made this mistake at some point..

Comments
  • 1
    only php allows that kind of shit
  • 0
    @liveCoder C++ as well
  • 0
    this isn't shit . it is really useful when going through a cursor. while ($a = $cursor->next())
  • 1
    if(anotherThing = thing) should get stopped by compiler if anotherThing is a literal constant like "10" or a string or something. Could always reverse your if statements. Can't bring myself to do it yet, IDE picks the "accidental assignments" up
  • 0
Add Comment