I typed in: break()
This gave me a syntax error what did I do wrong?
what language is this in? and in what context are you using it? in most languages break is used to break a loop
break
for(let i = 0; i < 10; i++){ if(i === 5) break; console.log(i); }
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
()
what language is this in? and in what context are you using it?
in most languages
break
is used to break a loopthis 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