In Ruby, you can do something like:
10.times { puts 'hello world' }
The best approach I can come up with in Elixir is this:
Enum.each((0..10), fn(x) -> IO.puts 'hello world' end)
If you run the program, you will get a warning hello_world.exs:1: warning: variable x is unused.
Question: Is there a better way to do this in Elixir?
Context: I am doing a simulation where 3,000,000 trials are needed. I do not go through the list. A simplified scenario will make 3,000,000 coins and record the number of goals.
source
share