Logo

Programming-Idioms

History of Idiom 78 > diff from v49 to v50

Edit summary for version 50 by programming-idioms.org:
New Go implementation by user [programming-idioms.org]

Version 49

2016-10-09, 10:24:28

Version 50

2016-10-09, 10:27:45

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 done := false; !done; {
	someThing()
	someOtherThing()
	done = !c()
}
Comments bubble
Explicit loop variable done shows the intent.
Origin
https://groups.google.com/forum/#!topic/golang-nuts/kA9RJPSeorM
Demo URL
https://play.golang.org/p/igYXC_hs2Z