Click here to Skip to main content
15,507,755 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 8:41
protectorNelek20-Sep-20 8:41 
GeneralRe: while(true) is not fun Pin
David O'Neil20-Sep-20 8:28
professionalDavid O'Neil20-Sep-20 8:28 
GeneralRe: while(true) is not fun Pin
Nelek20-Sep-20 8:43
protectorNelek20-Sep-20 8:43 
GeneralRe: while(true) is not fun Pin
BillWoodruff20-Sep-20 11:20
mveBillWoodruff20-Sep-20 11:20 
GeneralRe: while(true) is not fun Pin
honey the codewitch20-Sep-20 12:09
mvahoney the codewitch20-Sep-20 12:09 
GeneralRe: while(true) is not fun Pin
BillWoodruff20-Sep-20 12:41
mveBillWoodruff20-Sep-20 12:41 
GeneralRe: while(true) is not fun Pin
honey the codewitch20-Sep-20 12:45
mvahoney the codewitch20-Sep-20 12:45 
GeneralRe: while(true) is not fun Pin
trønderen21-Sep-20 3:42
trønderen21-Sep-20 3: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 4:00
mvahoney the codewitch21-Sep-20 4:00 
GeneralRe: while(true) is not fun Pin
trønderen21-Sep-20 4:17
trønderen21-Sep-20 4:17 
GeneralRe: while(true) is not fun Pin
honey the codewitch21-Sep-20 4:39
mvahoney the codewitch21-Sep-20 4:39 
GeneralRe: while(true) is not fun Pin
Grant Rostig21-Sep-20 20:04
Grant Rostig21-Sep-20 20:04 
GeneralRe: while(true) is not fun Pin
trønderen22-Sep-20 1:24
trønderen22-Sep-20 1:24 
GeneralRe: while(true) is not fun Pin
honey the codewitch22-Sep-20 5:34
mvahoney the codewitch22-Sep-20 5:34 
GeneralRe: while(true) is not fun Pin
Nelek20-Sep-20 21:31
protectorNelek20-Sep-20 21:31 
GeneralRe: while(true) is not fun Pin
Frank Malcolm24-Sep-20 13:40
Frank Malcolm24-Sep-20 13:40 
GeneralRe: while(true) is not fun Pin
BillWoodruff20-Sep-20 11:46
mveBillWoodruff20-Sep-20 11:46 
GeneralRe: while(true) is not fun Pin
Member 448047420-Sep-20 20:36
Member 448047420-Sep-20 20:36 
GeneralRe: while(true) is not fun Pin
Member 1486610420-Sep-20 20:47
Member 1486610420-Sep-20 20:47 
GeneralRe: while(true) is not fun Pin
Wizard of Sleeves20-Sep-20 21:23
Wizard of Sleeves20-Sep-20 21:23 
GeneralRe: while(true) is not fun Pin
Rage20-Sep-20 22:01
professionalRage20-Sep-20 22:01 
GeneralGoto considered useful Pin
Martijn Smitshoek20-Sep-20 21:48
Martijn Smitshoek20-Sep-20 21:48 
GeneralRe: while(true) is not fun Pin
Rene Balvert20-Sep-20 21:48
Rene Balvert20-Sep-20 21:48 
GeneralRe: while(true) is not fun Pin
trønderen21-Sep-20 3:47
trønderen21-Sep-20 3:47 
GeneralRe: while(true) is not fun Pin
Bob Beechey20-Sep-20 21:49
Bob Beechey20-Sep-20 21: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.


Straw Poll

An amazing AI programming tool is invented that can do one task perfectly. What would you choose?
  Results   22 votes