- Mastering Elixir
- André Albuquerque Daniel Caixinha
- 111字
- 2021-08-05 10:42:44
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
推薦閱讀
- Android應用程序開發與典型案例
- C# 從入門到項目實踐(超值版)
- Learning AWS Lumberyard Game Development
- 數據結構與算法JavaScript描述
- 機械工程師Python編程:入門、實戰與進階
- 名師講壇:Java微服務架構實戰(SpringBoot+SpringCloud+Docker+RabbitMQ)
- EPLAN實戰設計
- PhoneGap:Beginner's Guide(Third Edition)
- Cocos2d-x學習筆記:完全掌握Lua API與游戲項目開發 (未來書庫)
- H5頁面設計:Mugeda版(微課版)
- 機器學習與R語言實戰
- Tableau 10 Bootcamp
- HTML5+CSS3 Web前端開發技術(第2版)
- Nagios Core Administration Cookbook(Second Edition)
- Unity 5.X從入門到精通