Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Erlang - Bitwise Operators

-module(helloworld). 
-export([start/0]). 

start() -> 
   io:fwrite("~w~n",[00111100 band 00001101]), 
   io:fwrite("~w~n",[00111100 bxor 00111100]), 
   io:fwrite("~w~n",[bnot 00111100]), 
   io:fwrite("~w~n",[00111100 bor 00111100]).

Erlang - Relational Operators

-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]).

Erlang - Example2 Naming Variables

-module(helloworld). 
-export([start/0]). 

start() -> 
   X = 40, 
   Y = 50, 
   X = 60, 
   io:fwrite("~w",[X]).

Erlang Variables Declarations

-module(helloworld). 
-export([start/0]). 

start() -> 
   X = 40, 
   Y = 50, 
   Result = X + Y, 
   io:fwrite("~w",[Result]).

Erlang List Data Type

-module(helloworld). 
-export([start/0]). 

start() -> 
   L = [10,20,30] , 
   io:fwrite("~w",[length(L)]).

Erlang Map Data Type

-module(helloworld). 
-export([start/0]). 

start() -> 
   M1 = #{name=>john,age=>25}, 
   io:fwrite("~w",[map_size(M1)]).

Erlang Tuple Data Type

-module(helloworld). 
-export([start/0]). 

start() -> 
   P = {john,24,{june,25}} , 
   io:fwrite("~w",[tuple_size(P)]).

Erlang Bit String Data Type

-module(helloworld).
-export([start/0]).

start() ->
   Bin1 = <<10,20>>,
   X = binary_to_list(Bin1),
   io:fwrite("~w",[X]).

Erlang Boolean Data Type

-module(helloworld).
-export([start/0]).

start() ->
   io:fwrite(2 =< 3).

Erlang Atom Data Types

-module(helloworld).
-export([start/0]).

start() ->
   io:fwrite(atom1).

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.