I was geting the following error in my code:
a = 1
array = [1, 2]
array.include? a
=> true
a == 1 || array.include? a
=> syntax error, unexpected tIDENTIFIER, expecting end-of-input
I was thinking that you cannot have a space in an OR statement, or end with a variable, however the following code block works fine:
array.include? a || 1 == a
=> true
Then I managed to figure out how to get it to work:
a == 1 || array.include?(a)
=> true
I am so confused, can anyone explain?