Merge pull request #7063 from ageron/update-tutorial-on-dbg

Add a short paragraph to explain dbg forwarding, fixes #7061
This commit is contained in:
Luke Boswell 2024-09-11 07:04:38 +10:00 committed by GitHub
commit 3d9c4673af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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: