Friday, 21 August 2015

Basic Go: For loop

Go has only one looping construct, the for loop.
The basic for loop looks as it does in C or Java, except that the ( ) are gone (they are not even optional) and the { } are required.


As in C or Java, you can leave the pre and post statements empty.

At that point you can drop the semicolons: C's while is spelled for in Go.


Do comment, if it worked/Not worked for you.

No comments:

Post a Comment