Permalink
Browse files

feat(XIV): calculate roman for 14

  • Loading branch information...
antonydenyer committed Nov 16, 2017
1 parent 7e055fc commit 403e1864bd363fbce0e69d9aee5caaf16a71631c
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/roman.ex
View
@@ -1,6 +1,10 @@
defmodule Roman do
def to_roman(number, roman_accumulator) do
def to_roman(number, roman_accumulator) when number >= 4 do
to_roman(number - 4, roman_accumulator <> "IV")
end
def to_roman(number, roman_accumulator) when number <= 3 do
roman_accumulator <> String.duplicate("I", number)
end
@@ -16,10 +20,6 @@ defmodule Roman do
to_roman(number - 5, "V")
end
def to_roman(number, roman_accumulator) when number >= 4 do
to_roman(number - 4, roman_accumulator <> "IV")
end
def to_roman(number) do
to_roman(number, "")
end

0 comments on commit 403e186

Please sign in to comment.