and vs &&
Chiel Wester wo 30 jun 10
Last week we had a discussion about using the ‘and’ operator vs the ‘&&’ operator for equasions. The only reason to prefer ‘and’ above ‘&&’ would be that people say the code will be better readable and cleaner.
Although the code might be better readable, you have to be careful using the ‘and’ operator because it has a slightly different behaviour than the && operator. In this article you can see a very good example of this difference.
So, when using the and operator, make sure you put brackets around the equasion to prevent strange behaviour! If you don’t want to use the brackets, just use && this will save you from a lot of trouble
Gepost in hor | 0 reacties
Welcome to Holland On Rails
This weblog is the official Ruby techblog from the guys at Holder, a Ruby development company. Holder is also the company behind the RubyAndRails Europe Conference in Amsterdam.Recente Jobs
Bekijk alle jobs »»
Gereedschapskist
Onmisbare tools vooriedere developer!
- Ruby On Rails
Framework voor de web 2.0 developer. Eindelijk vooruitgang! - TextMate
Editor for true pro's
Typ, tab, top :-)
Nee, niet voor Win. - Made On A Mac
En nou is het over met die saaie grijze Windows bak van je!
Auteurs op deze site
Chris Obdam
'Less is more' evangelist, past dit ook dagelijks toe op zijn tandenborstel.Chiel Wester
Snelheidswonder op Ruby wielen. Leuk om mee te pair-programmen ;-)
Plaats je reactie