Click here to Skip to main content
15,867,568 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: while(true) is not fun Pin
Nelek20-Sep-20 7:41
protectorNelek20-Sep-20 7:41 
GeneralRe: while(true) is not fun Pin
David O'Neil20-Sep-20 7:28
professionalDavid O'Neil20-Sep-20 7:28 
GeneralRe: while(true) is not fun Pin
Nelek20-Sep-20 7:43
protectorNelek20-Sep-20 7:43 
GeneralRe: while(true) is not fun Pin
BillWoodruff20-Sep-20 10:20
professionalBillWoodruff20-Sep-20 10:20 
GeneralRe: while(true) is not fun Pin
honey the codewitch20-Sep-20 11:09
mvahoney the codewitch20-Sep-20 11:09 
GeneralRe: while(true) is not fun Pin
BillWoodruff20-Sep-20 11:41
professionalBillWoodruff20-Sep-20 11:41 
GeneralRe: while(true) is not fun Pin
honey the codewitch20-Sep-20 11:45
mvahoney the codewitch20-Sep-20 11:45 
GeneralRe: while(true) is not fun Pin
trønderen21-Sep-20 2:42
trønderen21-Sep-20 2:42 
Knuth's "Example 1" problem using structured statements for alternate loop exits:
for i in 1:m do

  // main loop body; may contain any number of statements:

  while A[i] != x;  // premature loop termination if x is found   

exitwhile           // do this on premature loop termination, i.e. "found"
  B[i]++; 

exitfor             // do this if loop reaches end of (valid) A[], i.e. "not found"
  A[i] := x;
  B[i] := 1;
  m = i;            // new search limit for subsequent x searches

endfor
I really miss this construct; I found it truly useful, but have seen it in a single language only, 30+ years ago.

Note that both the exitwhile and exitfor clauses are within the scope of the loop statement, with access to the loop control variable and any other variable declared within the loop. (This is essential to the usability of the construct.)
GeneralRe: while(true) is not fun Pin
honey the codewitch21-Sep-20 3:00
mvahoney the codewitch21-Sep-20 3:00 
GeneralRe: while(true) is not fun Pin
trønderen21-Sep-20 3:17
trønderen21-Sep-20 3:17 
GeneralRe: while(true) is not fun Pin
honey the codewitch21-Sep-20 3:39
mvahoney the codewitch21-Sep-20 3:39 
GeneralRe: while(true) is not fun Pin
Grant Rostig21-Sep-20 19:04
Grant Rostig21-Sep-20 19:04 
GeneralRe: while(true) is not fun Pin
trønderen22-Sep-20 0:24
trønderen22-Sep-20 0:24 
GeneralRe: while(true) is not fun Pin
honey the codewitch22-Sep-20 4:34
mvahoney the codewitch22-Sep-20 4:34 
GeneralRe: while(true) is not fun Pin
Nelek20-Sep-20 20:31
protectorNelek20-Sep-20 20:31 
GeneralRe: while(true) is not fun Pin
Frank Malcolm24-Sep-20 12:40
Frank Malcolm24-Sep-20 12:40 
GeneralRe: while(true) is not fun Pin
BillWoodruff20-Sep-20 10:46
professionalBillWoodruff20-Sep-20 10:46 
GeneralRe: while(true) is not fun Pin
Member 448047420-Sep-20 19:36
Member 448047420-Sep-20 19:36 
GeneralRe: while(true) is not fun Pin
Member 1486610420-Sep-20 19:47
Member 1486610420-Sep-20 19:47 
GeneralRe: while(true) is not fun Pin
Wizard of Sleeves20-Sep-20 20:23
Wizard of Sleeves20-Sep-20 20:23 
GeneralRe: while(true) is not fun Pin
Rage20-Sep-20 21:01
professionalRage20-Sep-20 21:01 
GeneralGoto considered useful Pin
Martijn Smitshoek20-Sep-20 20:48
Martijn Smitshoek20-Sep-20 20:48 
GeneralRe: while(true) is not fun Pin
Rene Balvert20-Sep-20 20:48
Rene Balvert20-Sep-20 20:48 
GeneralRe: while(true) is not fun Pin
trønderen21-Sep-20 2:47
trønderen21-Sep-20 2:47 
GeneralRe: while(true) is not fun Pin
Bob Beechey20-Sep-20 20:49
Bob Beechey20-Sep-20 20:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.