Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Open
jpalardy opened this issue Feb 7, 2024 · 3 comments
Open

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

jpalardy opened this issue Feb 7, 2024 · 3 comments

Comments

@jpalardy
Copy link

jpalardy commented Feb 7, 2024

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
Copy link
Contributor

inoas commented Feb 7, 2024

This seems to be correct?

iex(1)> x = (
...(1)>   IO.puts(1)
...(1)>   2
...(1)> )
1
2
iex(2)> x
2
iex(3)>

@inoas
Copy link
Contributor

inoas commented Feb 7, 2024

@jpalardy
Copy link
Author

jpalardy commented Feb 8, 2024

Yep, that works 👍

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants