Section 17. What is wrong with this code. "(ruby):8: syntax error, unexpected keyword_end, expecting $end"


test_1 should be true

test_1 = true || 1+2==3

test_2 = should be true

test_2 = 1-2==-1 && 1-2==-1

test_3 = should be false

test_3 = !1-1==0

Please help me, I'm so confused.


Remove the end statement
as it is only used in combination with a do or an IF statement

the do .... end is used a so-called =block= indicator

10.times do
    # begin of code-block 
    puts "===="
    # End of code-block 

In Ruby you have a second possibility to encapsulate a code-block
by using a pair of curly-brackets-{ }

1.times { 
    # code-block
    puts "===="

But you must keep in mind
that in some statements there is a strange behaviour
in order of precedence between a do-end and {..} block indicator......