Skip to content

Commit

Permalink
Document behavior of thrown exceptions in @repl (JuliaDocs#1598)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericphanson authored and Andrey Oskin committed Jun 21, 2021
1 parent 1b51410 commit 2ff7351
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion docs/src/man/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,8 @@ second block. A block with `continued = true` does not have any output.
## `@repl` block

These are similar to `@example` blocks, but add a `julia> ` prompt before each toplevel
expression. The `# hide` syntax may be used in `@repl` blocks in the same way
expression and do not fail upon encountering an error.
The `# hide` syntax may be used in `@repl` blocks in the same way
as in `@example` blocks. Furthermore, a semicolon `;` at the end of a line will
suppress the output as in the Julia REPL.

Expand All @@ -530,6 +531,24 @@ julia> a + b
```
````

And likewise

````markdown
```@repl
sqrt(-1)
```
````

will generate

````markdown
```julia
julia> sqrt(-1)
ERROR: DomainError with -1.0:
sqrt will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
```
````

Named `@repl <name>` blocks behave in the same way as named `@example <name>` blocks.

!!! note
Expand Down

0 comments on commit 2ff7351

Please sign in to comment.