Go目前有25个关键字。
来源:https://go.dev/ref/spec#Keywords
1
2
3
4
5
| break default func interface select
case defer go map struct
chan else goto package switch
const fallthrough if range type
continue for import return var
|
Python目前有35个关键字。
来源:https://docs.python.org/zh-cn/3.12/reference/lexical_analysis.html#keywords
1
2
3
4
5
6
7
| False await else import pass
None break except in raise
True class finally is return
and continue for lambda try
as def from nonlocal while
assert del global not with
async elif if or yield
|
来源:https://docs.oracle.com/javase/specs/jls/se21/html/jls-3.html#jls-3.9
ReservedKeyword:
1
2
3
4
5
6
7
8
9
10
11
| abstract continue for new switch
assert default if package synchronized
boolean do goto private this
break double implements protected throw
byte else import public throws
case enum instanceof return transient
catch extends int short try
char final interface static void
class finally long strictfp volatile
const float native super while
_ (underscore)
|
ContextualKeyword:
1
2
3
4
| exports opens requires uses yield
module permits sealed var
non-sealed provides to when
open record transitive with
|
来源:https://www.php.net/manual/en/reserved.keywords.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| __halt_compiler() abstract and array() as
break callable case catch class
clone const continue declare default
die() do echo else elseif
empty() enddeclare endfor endforeach endif
endswitch endwhile eval() exit() extends
final finally fn (as of PHP 7.4) for foreach
function global goto if implements
include include_once instanceof insteadof interface
isset() list() match (as of PHP 8.0) namespace new
or print private protected public
readonly (as of PHP 8.1.0) * require require_once return static
switch throw trait try unset()
use var while xor yield
yield from
|
详见 comm/Go/basic/operators
Go语言比较特殊的操作符有:
&^
以及&^=
,按位清除,按位清除赋值++
和--
是语句,且只有后置++
、--
,而没有前置++
、--
:=
用于短变量声明->
用在channel,目前有两种用法:用在函数参数、返回值类型;直接用在channel变量上,用于从接收channel变量的值,以及向channel发送指定值;...
目前有两种用法:用在函数、方法的声明上的最后一个参数,表示可以接受多个参数,在函数和方法体重可以通过这个参数获得一个完整切片;用着函数或方法调用上,用于向函数、方法传递实参,目前可以在切片和字符串类型的变量或字面量上使用。