Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

9
  • If this is indeed used as a switch case, this will not work like you expect it to work. If it works at all, it's just because the result of that expression happens to loosely compare to the switch comparison value.
    – deceze
    Commented Apr 6, 2011 at 9:07
  • @deceze: The questioner omitted the switch($expr)-part, so I had to guess. Maybe its just switch(true).
    – KingCrunch
    Commented Apr 6, 2011 at 9:17
  • @King Sure, but that would be just as weird and needs pointing out.
    – deceze
    Commented Apr 6, 2011 at 9:21
  • @deceze: Hmm.. valid point. Maybe I guessed a little bit too much. But what is weird with switch(true)?
    – KingCrunch
    Commented Apr 6, 2011 at 9:24
  • 2
    @King IMO switch(true) is abusing the switch statement and would be better replaced with an if. Maybe that's just me though.
    – deceze
    Commented Apr 6, 2011 at 9:26