Go – “While Do” and “Do While” loops in go

Ok, so the golang language does not exactly have the word “while” in it. Anyway, the do-while and while-do loops can be easily implemented with a for loop.

Some museum socks, not exactly related to the programming language. Although they have threads, thus you can always come up with something. 🙂

The main difference between the do-while and while-do is that in the case of do-while, the loop will be executed at least one, even if the condition is already false. At while-do the iteration will not be executed, if the condition is false.

This is the example:

And the result is quite expected:

Yup. That’s all! 🙂

Tagged with: , , ,