Erlang 16点是什么意思?
看看这段代码,有一个函数如下:Erlang 16点是什么意思?,erlang,Erlang,看看这段代码,有一个函数如下: socket_type_atom(16#00) -> pair; socket_type_atom(16#01) -> pub; socket_type_atom(16#02) -> sub; socket_type_atom(16#03) -> req; socket_type_atom(16#04) -> rep; socket_type_atom(16#05) ->
socket_type_atom(16#00) -> pair;
socket_type_atom(16#01) -> pub;
socket_type_atom(16#02) -> sub;
socket_type_atom(16#03) -> req;
socket_type_atom(16#04) -> rep;
socket_type_atom(16#05) -> dealer;
socket_type_atom(16#06) -> router;
socket_type_atom(16#07) -> pull;
socket_type_atom(16#08) -> push.
根据我对erlang整数表示法的理解,5#10表示以10为基数的整数5。那么,16#00
代表什么?如中所述:
有两种类型的数字文字,整数和浮点。此外
传统的表示法有两种特定于Erlang的表示法:
$char
ASCII value or unicode code-point of the character char.
base#value
Integer with the base base, that must be an integer in the range 2..36.
In Erlang 5.2/OTP R9B and earlier versions, the allowed range is 2..16.
因此,16#数字
就是十六进制的number
。例如:
1> 16#10 == 16.
true
或二进制:
2> 2#11111111.
255
基数16中的0,即0x0?哦,基数第一。哦!供将来参考:A注意到“从OTP23开始,您可以添加数字文本的
”,并提出了两行代码-第1行:>2\11\u 11==15。
和第2行:true
:此编辑旨在针对文章作者,作为编辑没有任何意义。它应该写下来作为评论或回答。