Skip to content

Commit 112f7a1

Browse files
authored
add some details to docstring of "if" (#37593)
1 parent da1d837 commit 112f7a1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

base/docs/basedocs.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,13 @@ otherwise the condition expression `x > y` is evaluated, and if it is true, the
646646
corresponding block is evaluated; if neither expression is true, the `else` block is
647647
evaluated. The `elseif` and `else` blocks are optional, and as many `elseif` blocks as
648648
desired can be used.
649+
650+
In contrast to some other languages conditions must be of type `Bool`. It does not
651+
suffice for conditions to be convertible to `Bool`.
652+
```jldoctest
653+
julia> if 1 end
654+
ERROR: TypeError: non-boolean (Int64) used in boolean context
655+
```
649656
"""
650657
kw"if", kw"elseif", kw"else"
651658

0 commit comments

Comments
 (0)