Ask coding questions

← Back to all posts
How do you properly do a break function?
ChezTacoz

I typed in:
break()

This gave me a syntax error what did I do wrong?

Answered by bearbearmo [earned 5 cycles]
View Answer
Voters
nazeww
ChezTacoz
Comments
hotnewtop
bearbearmo

what language is this in? and in what context are you using it?
in most languages break is used to break a loop

this outputs the numbers 0 to 4, because when I is 5 it breaks the loop.
the correct syntax is just break no (). I hope this is helpful

ChezTacoz

@bearbearmo I'm using python

ChezTacoz

@bearbearmo also thx

Axrevyn

@ChezTacoz You should mark his answer as correct. Click the checkmark next to his answer, under the upvote counter.