官术网_书友最值得收藏!

Integers

This type contains, as you would expect, numbers that can be written without a fractional component. The size of integers adjusts dynamically according to its magnitude—you don't have to worry about this: an integer will simply occupy more words in memory as it grows. Here's some basic arithmetic with integers:

iex> 25 + 8
33

To improve the readability of the code, you can also use underscores in between the digits of an integer, as shown here:

iex> 1_000_000 - 500_000
500000

Besides decimal, Elixir also supports integers written in binary, octal, and hexadecimal (using 0b, 0o, and 0x, respectively):

iex> 0b10001
17
iex> 0o21
17
iex> 0x11
17
主站蜘蛛池模板: 界首市| 柞水县| 上高县| 成都市| 察隅县| 乐业县| 衡阳县| 江山市| 吉木萨尔县| 晋城| 静宁县| 紫阳县| 盱眙县| 阿拉善右旗| 乌审旗| 南郑县| 七台河市| 泸水县| 曲沃县| 枣庄市| 贵州省| 丰台区| 乃东县| 鞍山市| 长岭县| 大安市| 济南市| 沂水县| 梓潼县| 梅州市| 南川市| 安丘市| 沅江市| 象山县| 哈尔滨市| 霸州市| 盐亭县| 乌海市| 青海省| 墨竹工卡县| 永平县|