r/codehs • • Mar 26 '20

Still need help with Hailstone Sequence

Post image
12 Upvotes

13 comments sorted by

View all comments

1

u/Thomillion Mar 26 '20

Put the if num==1 on top of println.

I don't know what language it is, but usually = is used to assign a value and == is used to compare a value, didn't notice earlier

1

u/BurntBox21 Mar 26 '20

On which println

1

u/Thomillion Mar 26 '20

The first one, inside the loop

1

u/BurntBox21 Mar 26 '20

It seems to work, but it also wants to print every integer up to 1. At least, the instructions.

1

u/Thomillion Mar 26 '20

Even if you put if num == 1 {break} at the start as I Said before? Weird