运算符与记号
数学符号与函数的扩展文档在 这里.
| 符号 | 含义 |
|---|---|
@ |
the at-sign marks a macro invocation; optionally followed by an argument list |
| ! | 感叹号是一个表示逻辑否定的前缀算符 |
a! |
在函数名的末尾,! 用作表示函数会修改参数(或多个参数) |
# |
the number sign (or hash or pound) character begins single line comments |
#= |
when followed by an equals sign, it begins a multi-line comment (these are nestable) |
=# |
end a multi-line comment by immediately preceding the number sign with an equals sign |
$ |
the dollar sign is used for string and expression interpolation |
| % | the percent symbol is the remainder operator |
| ^ | the caret is the exponentiation operator |
| & | single ampersand is bitwise and |
| && | double ampersands is short-circuiting boolean and |
| [ | ](/read/Julia-1.7-zh/b03d1d5dc0f200e1.md#Base.: |
| [ | |
| ⊻ | the unicode xor character is bitwise exclusive or |
| ~ | the tilde is an operator for bitwise not |
‘ |
a trailing apostrophe is the adjoint (that is, the complex transpose) operator Aᴴ |
| * | the asterisk is used for multiplication, including matrix multiplication and string concatenation |
| / | forward slash divides the argument on its left by the one on its right |
| [](/read/Julia-1.7-zh/b03d1d5dc0f200e1.md#Base.:\-Tuple{Any, Any}) | backslash operator divides the argument on its right by the one on its left, commonly used to solve matrix equations |
() |
parentheses with no arguments constructs an empty Tuple |
(a,…) |
parentheses with comma-separated arguments constructs a tuple containing its arguments |
(a=1,…) |
parentheses with comma-separated assignments constructs a NamedTuple |
(x;y) |
parentheses can also be used to group one or more semicolon separated expressions |
a[] |
array indexing (calling getindex or setindex!) |
[,] |
vector literal constructor (calling vect) |
[;] |
vertical concatenation (calling vcat or hvcat) |
[ ] |
with space-separated expressions, horizontal concatenation (calling hcat or hvcat) |
T{ } |
curly braces following a type list that type’s parameters |
{} |
curly braces can also be used to group multiple where expressions in function declarations |
; |
semicolons separate statements, begin a list of keyword arguments in function declarations or calls, or are used to separate array literals for vertical concatenation |
, |
commas separate function arguments or tuple or array components |
? |
the question mark delimits the ternary conditional operator (used like: conditional ? if_true : if_false) |
“ “ |
the single double-quote character delimits String literals |
“”” “”” |
three double-quote characters delimits string literals that may contain “ and ignore leading indentation |
‘ ‘ |
the single-quote character delimits Char (that is, character) literals |
`</code></td><td>the backtick character delimits <a href="https://docs.juliacn.com/latest/base/punctuation/base/@ref Running-External-Programs">external process</a> (<a href="$940c12bf1bd7a7a4.md#Base.Cmd">Cmd</a>) literals</td></tr><tr><td><code>A...</code></td><td>triple periods are a postfix operator that "splat" their arguments' contents into many arguments of a function call or declare a varargs function that "slurps" up many arguments into a single tuple</td></tr><tr><td><code>a.b</code></td><td>single periods access named fields in objects/modules (calling <a href="$940c12bf1bd7a7a4.md#Base.getproperty">getproperty</a> or <a href="$940c12bf1bd7a7a4.md#Base.setproperty!">setproperty!</a>)</td></tr><tr><td><code>f.()</code></td><td>periods may also prefix parentheses (like <code>f.(...)</code>) or infix operators (like <code>.+</code>) to perform the function element-wise (calling <a href="$4378b0a35c0ee55e.md#Base.Broadcast.broadcast">broadcast</a>)</td></tr><tr><td><code>a:b</code></td><td>colons (<a href="$b03d1d5dc0f200e1.md#Base.::">:</a>) used as a binary infix operator construct a range from <code>a</code> to <code>b</code> (inclusive) with fixed step size <code>1</code></td></tr><tr><td><code>a:s:b</code></td><td>colons (<a href="$b03d1d5dc0f200e1.md#Base.::">:</a>) used as a ternary infix operator construct a range from <code>a</code> to <code>b</code> (inclusive) with step size <code>s</code></td></tr><tr><td><code>:</code></td><td>when used by themselves, <a href="$4378b0a35c0ee55e.md#Base.Colon">Colon</a>s represent all indices within a dimension, frequently combined with <a href="$b3adad7c47c48f9c.md#man-array-indexing">indexing</a></td></tr><tr><td><code>::</code></td><td>double-colons represent a type annotation or <a href="$940c12bf1bd7a7a4.md#Core.typeassert">typeassert</a>, depending on context, frequently used when declaring function arguments</td></tr><tr><td><code>:( )</code></td><td>quoted expression</td></tr><tr><td><code>:a</code></td><td><a href="$940c12bf1bd7a7a4.md#Core.Symbol">Symbol</a> a</td></tr><tr><td><a href="$940c12bf1bd7a7a4.md#Core.:<:"><:</a></td><td>子类型运算符</td></tr><tr><td><a href="$940c12bf1bd7a7a4.md#Base.:>:">>:</a></td><td>supertype operator (reverse of subtype operator)</td></tr><tr><td><code>=</code></td><td>single equals sign is <a href="$d6d556bca7888cd0.md#man-variables">assignment</a></td></tr><tr><td><a href="$b03d1d5dc0f200e1.md#Base.:==">==</a></td><td>double equals sign is value equality comparison</td></tr><tr><td><a href="$940c12bf1bd7a7a4.md#Core.:===">===</a></td><td>triple equals sign is programmatically identical equality comparison</td></tr><tr><td><a href="$26f6d9666e1468fc.md#Core.Pair">=></a></td><td>right arrow using an equals sign defines a <a href="$26f6d9666e1468fc.md#Core.Pair">Pair</a> typically used to populate <a href="https://docs.juliacn.com/latest/base/punctuation/base/@ref Dictionaries">dictionaries</a></td></tr><tr><td><code>-></code></td><td>right arrow using a hyphen defines an <a href="$cc6658a26508303a.md#man-anonymous-functions">anonymous function</a> on a single line</td></tr><tr><td> |
>` |
∘ |
function composition operator (typed with \circ{tab}) combines two functions as though they are a single larger function |
