How to create a Dict in Elm for testing?

To create a list in elms, you can do:

list = ["test","test2"] 

But how can I create a dict for testing?

I read Dict - core 3.0.0 .

+6
source share
1 answer

let dict = Dict.fromList [("key1", "value1"), ("key2", "value2")]

To insert an element: let dict' = Dict.insert "key3" "value3" dict

To find an item:

 case Dict.get "key1" dict of Just value -> ... -- do something with value Nothing -> ... -- no such value in dict 
+10
source

All Articles