appacademy / prep-work

preparatory material for interviewing with App Academy
291 stars 339 forks source link

Explanation on how to use || could use more clarification #37

Closed aaadmin closed 10 years ago

aaadmin commented 10 years ago

It's not immediately clear why if number == (7 || 13) is preferred to number == (7 || 13) in this explanation:

"If you read number == (7 || 13) like English, you might think it means "Number is equal to 7 or 13". However, Ruby will not interpret your program this way. Instead, by writing 7 || 13, Ruby will ask if one of these is true. That's not what you want: you want to use || to connect two logical statements like (number == 7) and (number == 13)."

ruggeri commented 10 years ago

This was closed by 95278cced2987c2ab6e47d67600e4a68dbc81426. Thanks!