not vs !, and vs &&

It’s always confusing when you have similar methods that have slightly different meaning. What’s the difference between not vs !, and and &&?

The difference between is subtle enough that it might not matter most of the time, but it might bite you in the ass one day. It doesn’t say which is which, this post gives the example of precedence order. But just by experimenting, you can see that it’s and, or, and not that form statements, which can’t be used in arguments“hey” || “hello”) #=> “hey” || “hello”) #=> “hello” or “hello”) #=> error: can’t used statements in arguments or “hello”)) #=> “hello” putting it in parens makes it ok, but ugly



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s