3 ms·
for x <- 1..10 do IO.puts x end Isn't that a for loop?
by arrowsmith 3y ago
for x <- 1..10 do
IO.puts x
end
Isn't that a for loop?
- Munksgaard 3y agoIn Elixir that is a called a comprehension, just like the blog post is discussing.
- PKop 3y agoSimilar, but different in subtle ways when you get beyond the toy example posted here...particularly that it's always iterating a collection, vs being able to just arbitrarily loop based on arbitrary conditions..where you'd be able to easily break out of it, modify a mutable collection within it etc https://dev.to/brewinstallbuzzwords/does-elixir-have-for-loops-19p9 https://dev.to/brewinstallbuzzwords/does-elixir-have-for-loo... "Does Elixir have for loops?" https://elixirforum.com/t/changing-variables-in-a-loop/43526 https://elixirforum.com/t/changing-variables-in-a-loop/43526 "Changing variables in a loop" https://stackoverflow.com/questions/56196664/better-way-writing-nested-for-loops-in-elixir https://stackoverflow.com/questions/56196664/better-way-writ... https://stackoverflow.com/questions/48178773/adding-items-to-a-list-from-a-loop-with-conditions https://stackoverflow.com/questions/48178773/adding-items-to...