Real quick question about the "break"

UnRelatedBurner@sh.itjust.works to Programming@programming.dev – -6 points –

I'm studying programming, and I don't agree woth my teacher. She basically said that if we use break (and continue too maybe) our test is an instant fail. She's reasoning is that it makes the code harder to read, and breaks the flow of it or something. (I didn't get her yapping tbh)

I can't understand why break would do anything of the sorts. I asked around and noone agreed with the teacher. So I came here. Is there a benefit to not using breaks or continues? And if you think she's wrong, please explain why, briefly even. We do enough down talking on almost all teachers she doesn't need more online.

65

You are viewing a single comment

Ignore it (edit: obviously not for the purposes of the course, which someone helpfully jumped down my throat presuming). A lot of people somehow in charge of teaching coding couldn't code their way out of a wet paper bag.

They are in a ton of languages in all kinds of different families for a reason: they are a logical and fairly consistent expression of two fairly consistently logical ways to deal with control flow in the specific case of a loop. Also there's the switch-case case in C-style languages.

Now, there are legitimate arguments for avoiding tons of of exotic control flow shenanigans, but if someone doesn't understand break/continue, then the problem is 100% theirs and nobody should take their advice on anything much, let alone relating to programming.

2 more...