I'm stuck in number 2 of 4 questions in for Loop ruby. What is the last answer? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 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

2nd Nov 2016, 5:57 AM
Rid Amsal
Rid Amsal - avatar
5 Answers
+ 3
Remember that = is to assign a value and == is to compare it
6th Nov 2016, 10:26 PM
Isai Cortes
Isai Cortes - avatar
+ 3
The answer goes like this for x in ( 0...99 ) puts x break if(x == 8 ) end
2nd Dec 2016, 2:50 AM
Sampreet Gaonkar
+ 2
thanks for the reply, i finally figure it out: ==
4th Nov 2016, 7:59 AM
Rid Amsal
Rid Amsal - avatar
+ 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..
21st Nov 2016, 11:23 AM
Darsh
Darsh - avatar
0
= is for assignment and == is for ewuality
20th Nov 2016, 3:12 AM
Daniel Cadwell
Daniel Cadwell - avatar