Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Nested tuples syntax, expecting token #3779

Closed
faustinoaq opened this issue Dec 25, 2016 · 0 comments
Closed

Nested tuples syntax, expecting token #3779

faustinoaq opened this issue Dec 25, 2016 · 0 comments

Comments

@faustinoaq
Copy link
Contributor

crystal 0.20.3

Code:

{
  { "a", "b" }
}

Output: Syntax error in eval:2: expecting token '=>', not 'NEWLINE'

Solutions?:

  1. With comma at end:
{
  { "a", "b" },
}
  1. With brace at end:
{
  { "a", "b" }}

Also comma isn't needed when the tuple have 2 nested tuples or more:

t = {
  {"a", "b"},
  {"a", "b"}
}

But, crystal tool format always add comma at the end.

# After crystal tool format
t = {
  {"a", "b"},
  {"a", "b"},
}

Happy Christmas! 🎄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants