Skip to content

Don't understand the nickel repl example in the readme #388

Answered by yannham
bew asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks for reporting!

You're correct. Running let x = 2 in x + x prints 4, and does NOT put x in scope. However, if you use a top-level let without an in, you can add stuff to the environment:

nickel> let x = 2 in x + x
4

nickel>x
error: Unbound identifier
  ┌─ repl-input-1:1:1
  │
1 │ x
  │ ^ this identifier is unbound

nickel> let x = 2 + 2
nickel> x
4

We'll fix the example.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@bew
Comment options

Answer selected by bew
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants