To create a list in elm you can do:
list = ["test","test2"]
But how can I create a Dict for testing purposes?
I've read Dict - core 3.0.0.
let dict = Dict.fromList [("key1", "value1"), ("key2", "value2")]
To insert an element: let dict' = Dict.insert "key3" "value3" dict
To look up an element:
case Dict.get "key1" dict of
Just value -> ... -- do something with value
Nothing -> ... -- no such value in dict
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