Mathematics-Erlang
所属分类:数学计算
开发工具:Erlang
文件大小:0KB
下载次数:0
上传日期:2023-11-01 15:20:19
上 传 者:
sh-1993
说明: Erlang是一种函数式编程语言,用于实时通信。这个简单的包用于区分偶数和...
(Erlang is a functional programming language and is used for real-time communication. This simple package is used to distinguish even and odd numbers)
文件列表:
math_functions.erl (127, 2023-11-01)
# Mathematics-Erlang
Erlang is a functional programming language and is used for real-time communication. This simple package is used to distinguish even and odd numbers
![Logo](https://serokell.io/files/qa/qap56dhf.1_(41)_(1).jpg)
## Usage/Examples
math_functions.erl
```
-module(math_functions).
-export([even/1, odd/1]).
even(X) when X >= 0 -> (X band 1) == 0.
odd(X) when X > 0 -> not even(X).
```
## Compile the application
Run the "erl" commands in your bash line to start the Erlang engine
```bash
Erlang/OTP 24 [erts-12.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]
1> c (math_functions).
{ok,math_functions}
2> math_functions:even(12).
true
3> math_functions:odd(12).
false
```
## Erlang/OTP Documentation
[Erlang/OTP Documentation](https://www.erlang.org/docs)
近期下载者:
相关文件:
收藏者: