Plezuro/built-in types

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Plezuro provides some built-in classes (types). Moreover you can create your own classes. Each variable is an object of a class, like in Ruby. Therefore all variables are passes into reference. In the next chapter we will discuss the difference between reference and copying.
The list of basic built-in classes with their using:


//number
$x = 2.3e45;
$y = 0xff; //hexadecimal
$z = 072; //octal
$a = 0b11011; //binary
//string
$b = 'aaaaaaaaaaaaaaaaaa';
$c = "wfefwfwf";
$cc = '''xxx
yyy
zzz''';
//list
$d = [1,2,3,4];
//dictionary
$f = #[1,2,3,4];
//set
$g = $[3,4,5];
//error
$h = 1/0;
//class
$i = 1.class;
//package
$j = i.package;
//pair
$k = 3:4;
//procedure
$l = {1+2};
//tuple
(x,y,z,a,b,c,cc,d,e,f,g,h,i,j,k,l)