-7

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.

(page 2) 20 comments
sorted by: hot top controversial new old
[-] velox_vulnus@lemmy.ml 1 points 7 months ago* (last edited 7 months ago)

Can you at least share a code snippet so we have any idea about what we are looking into?

Your teacher is wrong here, at least from what I'm getting the vibe. Those two keywords don't make the program unreadable, they're there to serve a purpose.

[-] UnRelatedBurner@sh.itjust.works -2 points 7 months ago

there is no code snippet, it's in general. break = fail. Maybe there are some cases where this isn't true, but I have very little experience with this so far.

[-] amio@kbin.social 0 points 7 months ago* (last edited 7 months ago)

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.

load more comments (2 replies)
load more comments
view more: ‹ prev next ›
this post was submitted on 29 Nov 2023
-7 points (40.0% liked)

Programming

16210 readers
184 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS