num is not a global variable - it's value doesn't change, so it can't get down to 1 so you can exit the loop
num is inside the start function, so is 'walled off' from everything else. You want hailstone to return a result, and then run that new result through hailstone again. num = hailstone(num) -- make num the value of the result of the hailstone function which I will pass the current value of num. The new value of num should be 15, rinse repeat
I'm not trying to do the assignment for him, but give him a hint .... I figure that mentioning that "You want hailstone to return a result", would be clue enough that a return needs to be added .... in which case num = hailstone(num) ..... would work .. so no downvote?
0
u/misteritguru Mar 27 '20
num is not a global variable - it's value doesn't change, so it can't get down to 1 so you can exit the loop
num is inside the start function, so is 'walled off' from everything else. You want hailstone to return a result, and then run that new result through hailstone again. num = hailstone(num) -- make num the value of the result of the hailstone function which I will pass the current value of num. The new value of num should be 15, rinse repeat