For example, in one branch, I want see how many times a number is divisible by 1000, then pass the starting number less that amount into the function recursively. This is what I have written:
if num // 1000 > 0 then
repeat (num // 1000) (String.fromChar 'M')
convertToRom (num - (num // 1000) * num)
However, I get the following error in the REPL when testing:
> 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 - (num // 1000) * num)
Maybe you forgot some parentheses? Or a comma?
How can I write multiple lines of code for a single if branch?
Aucun commentaire:
Enregistrer un commentaire