- Erlang Tutorial
- Erlang - Home
- Erlang - Overview
- Erlang - Environment
- Erlang - Basic Syntax
- Erlang - Shell
- Erlang - Data Types
- Erlang - Variables
- Erlang - Operators
- Erlang - Loops
- Erlang - Decision Making
- Erlang - Functions
- Erlang - Modules
- Erlang - Recursion
- Erlang - Numbers
- Erlang - Strings
- Erlang - Lists
- Erlang - File I/O
- Erlang - Atoms
- Erlang - Maps
- Erlang - Tuples
- Erlang - Records
- Erlang - Exceptions
- Erlang - Macros
- Erlang - Header Files
- Erlang - Preprocessors
- Erlang - Pattern Matching
- Erlang - Guards
- Erlang - BIFS
- Erlang - Binaries
- Erlang - Funs
- Erlang - Processes
- Erlang - Emails
- Erlang - Databases
- Erlang - Ports
- Erlang - Distributed Programming
- Erlang - OTP
- Erlang - Concurrency
- Erlang - Performance
- Erlang - Drivers
- Erlang - Web Programming
- Erlang Useful Resources
- Erlang - Quick Guide
- Erlang - Useful Resources
- Erlang - Discussion
Erlang - Relational Operators
Following are the relational operators available in Erlang.
Operator | Description | Example |
---|---|---|
== | Tests the equality between two objects | 2 = 2 will give true |
/= | Tests the difference between two objects | 3 /= 2 will give true |
< | Checks to see if the left object is less than the right operand. | 2 < 3 will give true |
=< | Checks to see if the left object is less than or equal to the right operand. | 2 =<3 will give true |
> | Checks to see if the left object is greater than the right operand. | 3 > 2 will give true |
>= | Checks to see if the left object is greater than or equal to the right operand. | 3 >= 2 will give true |
The following code snippet shows how the various operators can be used.
Example
-module(helloworld). -export([start/0]). start() -> io:fwrite("~w~n",[3==2]), io:fwrite("~w~n",[3/=2]), io:fwrite("~w~n",[3<2]), io:fwrite("~w~n",[3=<2]), io:fwrite("~w~n",[3>2]), io:fwrite("~w~n",[3>=2]).
The output of the above program will be −
Output
false true false false true true
erlang_operators.htm
Advertisements