DEV Community

Discussion on: Daily Challenge #201 - Complete the Pattern

Collapse
 
itsjesusurias profile image
Jesus Urias

Here is my solution with Elixir

defmodule Meh do
  def pattern(number) when number < 1, do: " "
  def pattern(number) do
    Enum.map(1..number, fn x -> IO.puts(String.duplicate(Integer.to_string(x), x)) end)
  end
end

here is the output:

iex(1)> Meh.pattern(6)
1
22
333
4444
55555
666666
[:ok, :ok, :ok, :ok, :ok, :ok]