gleam-lang / website

🏡 Gleam's website and guide
https://gleam.run
Apache License 2.0
93 stars 181 forks source link

Invalid Elixir block syntax in "Gleam for Elixir Users" #298

Open jpalardy opened 7 months ago

jpalardy commented 7 months ago

I was reading the Blocks section of the Gleam for Elixir Users and I was surprised by this syntax — when I tried it in iex, it's not valid Elixir

x = do
  print(1)
  2
end

(code link)

Screenshot 2024-02-07 at 10 27 19

Maybe there is a syntax, but I couldn't find it 🤔

(I saw 1.14 in the screenshot, but I tried 1.15 and 1.16 too: same problem)

inoas commented 7 months ago

This seems to be correct?

iex(1)> x = (
...(1)>   IO.puts(1)
...(1)>   2
...(1)> )
1
2
iex(2)> x
2
iex(3)>
inoas commented 7 months ago

https://hexdocs.pm/elixir/1.16.1/syntax-reference.html#blocks ... same for ages https://hexdocs.pm/elixir/1.8.0/syntax-reference.html#blocks

jpalardy commented 7 months ago

Yep, that works 👍

Should I open a PR, or you've got it?