For example, in one branch I want to see how many times the number is divided by 1000, and then the initial number is passed less than this amount to the function recursively. Here is what I wrote:
if num // 1000 > 0 then
repeat (num // 1000) (String.fromChar 'M')
convertToRom (num % 1000)
However, when testing, I get the following error in the REPL:
> getRomNums 3500
-- TYPE MISMATCH ----------------------------------------- .\.\RomanNumerals.elm
Function `repeat` is expecting 2 arguments, but was given 4.
34| repeat (num // 1000) (String.fromChar 'M')
35|> convertToRom (num % 1000)
Maybe you forgot some parentheses? Or a comma?
How to write multiple lines of code for one if branch?
The unrelated side of the note: the format system makes the double slash a comment, but in Elm, the double slash is an integer. Not sure how to fix it.
source
share