Does the guide ever explain `let`?

Someone on my team asked a syntax question about let and I wanted to point them to the guide, but I searched through and I actually can’t find a single reference to it. This seems like a pretty big gap to me, i.e. “How to create local variables?” is just not mentioned.

Time · An Introduction to Elm has an example using a let, but that’s it.

Similarly, the fact that variables must be lowercase wasn’t mentioned outside the context of type variables. I couldn’t find a reference to types being capitalized either.

I believe the official guide is very good, but did I just miss it? I wouldn’t think this was intentional. If it wasn’t intentional, I would be glad to contribute some language as a starting off point.

1 Like

(This is not the guide, but just noting that it’s mentioned here (though it does not mention lower and upper case): docs/syntax)

2 Likes

A piece of Elm syntax that exists that does not sem to be documented anywhere is as:

type Id = Id String

someFun (Id val) as id =
   ...

Gives you both val : String and id : Id as args in your function.

5 Likes

(The correct syntax is someFun (Id val as id) =, though.)

5 Likes

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