Programming-Idioms

History of Idiom 78 > diff from v48 to v49

Edit summary for version 49 :
[Go] Slighlty more relevant Demo

Version 48

2016-10-09, 10:14:18

Version 49

2016-10-09, 10:24:28

Idiom #78 "do while" loop

Execute a block once, then execute it again as long as boolean condition c is true.

Idiom #78 "do while" loop

Execute a block once, then execute it again as long as boolean condition c is true.

Extra Keywords
until
Extra Keywords
until
Code
for{
   someThing()
   …
   someOtherThing()
   if !c {
     break
   }
}
Code
for{
   someThing()
   someOtherThing()
   if !c {
     break
   }
}
Comments bubble
Go has no do while loop, use the for loop, instead.
Comments bubble
Go has no do while loop, use the for loop, instead.
Doc URL
https://golang.org/ref/spec#For_statements
Doc URL
https://golang.org/ref/spec#For_statements
Demo URL
http://play.golang.org/p/aNVIjY8oVK
Demo URL
https://play.golang.org/p/bRams03UpA