Skip to main content

All Questions

2 votes
2 answers
150 views

Did labelled loops pre-date for loops?

Was the first implementation of looping control flow effectively the goto (or something like a labelled JMP in assembler) or was there another syntactic construction? for (für) was introduced in ...
52d6c6af's user avatar
  • 730
1 vote
2 answers
115 views

Factored out loop control in Python

I have a for loop in python like this: for item in items: onwards = make_flow_decision(item) if onwards == 'break': break elif onwards == 'continue': continue elif ...
mlissner's user avatar
  • 131
0 votes
1 answer
147 views

Recursion, iteration, and ...? [closed]

Here are three common code structures that apply a function multiple times: foo(x) { if basecase(x) return k else return foo(g(x)) } uses recursion. for i in 0..10 { n *= bar(i) } uses ...
Alex Celeste's user avatar
6 votes
5 answers
18k views

Are there real-life usage and applications for "do while" loops? [closed]

When I see for and while loops all over production codes and mammoth projects, the last time I saw a do while loop is for a university assignment involving menu-based console input program. About 50 ...
ADTC's user avatar
  • 679
5 votes
2 answers
2k views

Why do some programming languages have break statements, but not higher-order break statements? [closed]

I may have been exposed to exactly the wrong languages, but though many have loops and break statements, none of the languages I am familiar with have higher-order break statements¹. While a regular ...
Wrzlprmft's user avatar
  • 198
-1 votes
9 answers
37k views

Loops in real-life problems [closed]

I'm learning C as my first programming language. I'm confused on how do loops work in real-life. In programming every function has a reason. example - if/else statements are used if we have ...
Dylan Cole's user avatar