slovodefinícia
loop-and-a-half
(foldoc)
loop-and-a-half

A loop structure with its termination test in
the middle. This contrasts with the more common while loop
which has the test at the beginning or a repeat loop which
has it at the end.

A generic example gets a value, tests it then processes it:

while (true) {
value = get();
if (isTerminal(value)) break;
process(value);
}

Alternatives require either an extra get() before the loop:

value = get();
while (! isTerminal(value))
process(value);
value = get();
}

or an extra test for termination:

do {
value = get();
done = isTerminal(value);
if (! done) process(value);
} while (! done);

The structure is discussed, though not named as such, in

[Donald Knuth, "Structured programming with goto statements",
Computing Surveys, December 1974].

A good summary is presented in

[Eric S. Roberts, "Loop Exits and Structured Programming:
Reopening the Debate", ACM SIGCSE, March 1995].

(2019-09-03)
podobné slovodefinícia

Nenašli ste slovo čo ste hľadali ? Doplňte ho do slovníka.

na vytvorenie tejto webstránky bol pužitý dictd server s dátami z sk-spell.sk.cx a z iných voľne dostupných dictd databáz. Ak máte klienta na dictd protokol (napríklad kdict), použite zdroj slovnik.iz.sk a port 2628.

online slovník, sk-spell - slovníkové dáta, IZ Bratislava, Malé Karpaty - turistika, Michal Páleník, správy, údaje o okresoch V4