DEV Community

Discussion on: Which types of loops are most popular in the programming languages you use?

Collapse
 
rhymes profile image
rhymes

Go only has for loops so there's not much of a choice there 😂

In Python I use for as well combined with various iterators. List comprehensions are favored over map and reduce there.

Collapse
 
cathodion profile image
Dustin King

The for loop in Go is more flexible than the one in C though. I just started with Go, and it's surprising how much they chose to diverge from other C-like languages.

Collapse
 
therealkevinard profile image
Kevin Ard

I like go's for a lot. It can be a for, a while, or an infinite loop. It's all in how you use it.

The same idea shows up all over the place in it: "here's some minimal core, fiddle it however you want". It's one of its main attractions ♥️

Collapse
 
kataras profile image
Gerasimos (Makis) Maropoulos

Exacltly. I was ready to post the same about Go xD

Collapse
 
buphmin profile image
buphmin

Though go is kind of cheating since it's "for" loop can behave in many ways.

Collapse
 
quii profile image
Chris James

Honestly it's one of many reasons Go is great, no bikeshedding about iteration