Skip to content

Conversation

@stormasm
Copy link
Contributor

@stormasm stormasm commented Dec 7, 2024

I was going through the examples and noticed that this one appears to be syntactically not correct

if true { print "hello!" }, loop { print "press ctrl-c to exit" }

it should be a semi-colon instead of a comma

if true { print "hello!" }; loop { print "press ctrl-c to exit" }

Also when I fire up this example in the repl
the comma does not complete
whereas the semi-colon does

@stormasm
Copy link
Contributor Author

stormasm commented Dec 7, 2024

nushell/nushell#740 (comment)

This works !

print hello;
print bye

This does not work !

print hello,
print bye

@stormasm
Copy link
Contributor Author

stormasm commented Dec 7, 2024

https://www.nushell.sh/book/types_of_data.html#types-at-a-glance

Here is the reference in the book !

@stormasm
Copy link
Contributor Author

stormasm commented Dec 7, 2024

In reference to a block...

Note how the semicolon works like a charm 😄

if true {print hello}; if true {print bye}

The following is broken

if true {print hello}, if true {print bye}

@fdncred
Copy link
Contributor

fdncred commented Dec 7, 2024

I don't think the entire list of blocks is meant to be run. It's just examples of two blocks separated by a comma. Just like the rest of the examples in this table with commas like floats, strings, ranges, tables, closures.

@stormasm
Copy link
Contributor Author

stormasm commented Dec 7, 2024

Ok cool ! 😄
Not obvious at first glance but makes sense...
Thanks for taking a look...

@stormasm
Copy link
Contributor Author

stormasm commented Dec 7, 2024

I am closing this PR.

@stormasm stormasm closed this Dec 7, 2024
@stormasm stormasm deleted the types_of_data branch December 7, 2024 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants