Multiline function definition on Windows CMD Repl?

Hello all. This is my first post, so hopefully I can ask a good question.

I’m currently very interested in elm, and want to learn how to define functions over multiple lines in Elm REPL for the windows command prompt, for example:

double 0 = 0
double x = x * 2

However when I hit enter, it only goes to the next line.

Any hints?

Hey, it’s not a repl limitation, you cannot define elm functions multiple times. You’d need pattern matching on the input, such as:

double x =
   case x of
      0 -> 0
      _ -> x * 2
1 Like

ahh… I’m mixing my syntax between Elm and Haskell. I think that’s it. Thanks!

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.