English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Erlang Logic Operator

Erlang Operators

The following are the logical operators available in Erlang.

Operator Description Example
or Logical 'or' operator True or true results in true
andLogical 'and' operator True and false results in false
notLogical 'not' operator Not false results in true
xorLogical 'xor' operator True xor false results in false

The following code snippet shows how to use various operators.

Online Example

-module(helloworld). 
-export([start/0]). 
start() -> 
   io:fwrite("~w~n",[true or false]),  
   io:fwrite("~w~n",[true and false]), 
   io:fwrite("~w~n",[true xor false]), 
   io:fwrite("~w~n",[not false]).

The output of the above program will be:

true
false
true
true

Erlang Operators