- 2
I'm stuck in number 2 of 4 questions in for Loop ruby. What is the last answer?
to stop the loop if X equal to 8
5 Answers
+ 3
Remember that = is to assign a value and == is to compare it
+ 3
The answer goes like this
for x in ( 0...99 )
puts x
break if(x == 8 )
end
+ 2
thanks for the reply, i finally figure it out: ==
+ 1
'=' This is the sign that assign a value to a variable for example X=1 or X="STRING" and the "==" symbol assign a variable to a variable simply if we give a value of 9 to X and 8 to y and say X==Y we will get an output false because 9 and 8 are not the same..
0
= is for assignment and == is for ewuality