- 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
推薦閱讀
- Learning Single:page Web Application Development
- Mastering Ember.js
- PHP 7底層設計與源碼實現
- Selenium Design Patterns and Best Practices
- Python進階編程:編寫更高效、優雅的Python代碼
- Python Tools for Visual Studio
- PLC編程及應用實戰
- Building Serverless Applications with Python
- Learning ArcGIS for Desktop
- 新一代SDN:VMware NSX 網絡原理與實踐
- Web前端應用開發技術
- OpenStack Networking Essentials
- SpringBoot從零開始學(視頻教學版)
- INSTANT Apache ServiceMix How-to
- AI自動化測試:技術原理、平臺搭建與工程實踐