This is a really noob question, i'm sorry but my search on the internet can't find the answer. I have the following code:
-- MODEL
type alias Model = Int
model : Model
model =
0
-- UPDATE
type Msg = Increment | Decrement | Reset
update : Msg -> Model -> Model
update msg model =
case msg of
Increment ->
model + 1
Decrement ->
model - 1
Reset ->
model = 0
I am trying to implement the reset that sets the model value to 0. But i'm getting a compilation error:
The = operator is reserved for defining variables. Maybe you want == instead? Or maybe you are defining a variable, but there is whitespace before it?
Please help!
You only need to write the model's new value there. In this case, that'll be just 0
:
Reset ->
0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With