Cam you please help me with this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Cam you please help me with this code

it says "nil can't be concerned into float" https://code.sololearn.com/ct17YYbotL33/?ref=app

11th Oct 2018, 5:27 AM
Francisco
Francisco - avatar
2 Answers
+ 1
I'm not good at Ruby, but it works if you change it like this: if N > 0 b = 1.0 20.times do b = N/a a = (a+b)/2 end puts b
11th Oct 2018, 6:13 AM
Anna
Anna - avatar
0
Try assigning b before Did it worked?
11th Oct 2018, 5:34 AM
Daniele Bonomi
Daniele Bonomi - avatar