Skip to content

Commit afc504b

Browse files
authored
Docstring for ; Uses (#41952)
1 parent a11de31 commit afc504b

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

base/docs/basedocs.jl

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -974,9 +974,19 @@ kw"..."
974974
;
975975
976976
`;` has a similar role in Julia as in many C-like languages, and is used to delimit the
977-
end of the previous statement. `;` is not necessary after new lines, but can be used to
977+
end of the previous statement.
978+
979+
`;` is not necessary at the end of a line, but can be used to
978980
separate statements on a single line or to join statements into a single expression.
979-
`;` is also used to suppress output printing in the REPL and similar interfaces.
981+
982+
Adding `;` at the end of a line in the REPL will suppress printing the result of that expression.
983+
984+
In function declarations, and optionally in calls, `;` separates regular arguments from keywords.
985+
986+
While constructing arrays, if the arguments inside the square brackets are separated by `;`
987+
then their contents are vertically concatenated together.
988+
989+
In the standard REPL, typing `;` on an empty line will switch to shell mode.
980990
981991
# Examples
982992
```julia
@@ -993,6 +1003,19 @@ julia> foo();
9931003
9941004
julia> bar()
9951005
"Hello, Mars!"
1006+
1007+
julia> function plot(x, y; style="solid", width=1, color="black")
1008+
###
1009+
end
1010+
1011+
julia> [1 2; 3 4]
1012+
2×2 Matrix{Int64}:
1013+
1 2
1014+
3 4
1015+
1016+
julia> ; # upon typing ;, the prompt changes (in place) to: shell>
1017+
shell> echo hello
1018+
hello
9961019
```
9971020
"""
9981021
kw";"

0 commit comments

Comments
 (0)