+ 1
Practice example guidance (Ruby)
So I thought in expressions it goes line by line. Can someone assist me with why the answer came out the way it did? The answer was 7 x=5 unless x<8 x += 3 else x += 2 End
3 Answers
+ 4
Jeshua Pence ,
using <unless ...> is the same as if you are using <if not ...>
so in the code sample the <else> clause is executed. this will finally give 5 + 2, which is 7.
please also note, that <end> has to be in lowercase
+ 3
unless will execute when the statement is false. When the statement is true, then else will be executed.
+ 1
Pls add language on which the question about , in tags..