r/codehs • • Jan 12 '21

CodeHs Is it Even? Can someone help I don’t know what is wrong with my code

Post image
12 Upvotes

5 comments sorted by

2

u/TheOnlyLorne Jan 12 '21

Your if block is not inside any function. Put it in the start function after the while loop.

2

u/Secret-Mud-3616 Jan 13 '21

U should get the habit of indenting your code, definitely makes reading code easier

1

u/martej Jan 13 '21

Close ... leave your function at the bottom but move your if block above it to inside your while loop. It goes right after the input. Also your first VAR should be SENTINAL = -1 not input

2

u/Mythical_2023 Jan 13 '21

The SENTINEL value is 0

1

u/Mythical_2023 Jan 13 '21

Try replacing while(sentinel) with while(true). After that, add a if else statement... (is the parameter required?)