-
Notifications
You must be signed in to change notification settings - Fork 0
Basics (type and operators)
AxelHumeau edited this page Jan 13, 2024
·
3 revisions
In LobsterLang we have 5 types :
Int
Boolean
String
List
Function
Operations are stricly permetted to certains combination of types and only right-associative
-> denote the return type of the operator
Operators and the associated types are:
-
@
: any type ->String
(to string) -
!
:Boolean
->Boolean
(boolean not) -
~
:List
->Int
(length)
-
+
: twoInt
->Int
(addition) or twoString
->String
(concatenation) -
-
: twoInt
->Int
(substraction) -
*
: twoInt
->Int
(multiplication) -
/
: twoInt
->Int
(division) -
%
: twoInt
->Int
(modulo) -
==
: twoInt
->Boolean
(equal) -
!=
: twoInt
->Boolean
(not equal) -
>
: twoInt
->Boolean
(greater than) -
>=
: twoInt
->Boolean
(greater than or equal) -
<
: twoInt
->Boolean
(lesser than) -
<=
: twoInt
->Boolean
(lesser than or equal) -
&&
: twoBoolean
->Boolean
(boolean and) -
||
: twoBoolean
->Boolean
(boolean or) -
^^
: twoBoolean
->Boolean
(boolean xor) -
++
:List
and any type ->List
(append) -
--
:List
and any type ->List
(remove all occurences) -
!!
:List
andInt
-> any type (Get an element) orString
andInt
->String
(Get a substring of one character) -
$
: two any type (then operator)