Skip to content

Commit

Permalink
Merge pull request #7063 from ageron/update-tutorial-on-dbg
Browse files Browse the repository at this point in the history
Add a short paragraph to explain dbg forwarding, fixes #7061
  • Loading branch information
lukewilliamboswell authored Sep 10, 2024
2 parents af7766f + 557b78e commit 3d9c467
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions www/content/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,12 @@ You can give `dbg` any expression you like, for example:
dbg Str.concat singular plural
```

You can also use `dbg` as a function inside an expression, which will print the function argument to stderr and then return the argument to the caller. For example:

```roc
inc = \n -> 1 + dbg n
```

### [Tuples](#tuples) {#tuples}

One way to have `dbg` print multiple values at a time is to wrap them in a record:
Expand Down

0 comments on commit 3d9c467

Please sign in to comment.