Project

General

Profile

Actions

Operators in Scol

On integers :

plus : + : 1+2 5 + 20
minus : - : 1 - 2 20 - 5
multiply : * : 1*2 20 * 5
divide : / : 1/2 20 / 5
modulo : mod : mod 1 2 mod 20 5

On floatting points :

plus : +. : 1.0 +.2.2 5.1 +. 20.0
minus : -. : 1.0 -. 2.2 20.0 -. 5.1
multiply : *. : 1.0*.2.2 20.0 *. 5.1
divide : /. : 1.0/.2.2 20.0 /. 5.1
modulo : mod. :

On strings :

concatenate : strcat : strcat "Bob" "Alice" => "BobAlice"
concatenate : strncat : strncat "Bob" :: " and " :: "Alice" :: nil => "Bob and Alice"
sub string : substr aString position length : substr "Bob and Alice are married" 8 5 => "Alice"

Logicals :

and : && : (x > 5) && (x < 10)
or : || : (x < 5) || (x > 10)
not : ! : !1 (=> 0)

Bit by bit (like C) :

and : & : 5 & 3 5 & 2
or : | : 5 | 3 5 | 2
>> : 5 >> 1
<< : 5 << 1

h2. Compare :

> : 5 > 2 is true
>= : 5 >= 5 is true
< : 5 < 2 is false
<= : 5 <= 2 is false
== : 5 == 5 is true

Others :

different != : 5 != 2 is true
compare two strings : strcmp stringA stringB : return 1, -1 or 0 if equal (like C)

Priority :

like C

License : CC-BY-SA-2.0
Tutorial by iri
Updated by /

Updated by iri about 12 years ago · 1 revisions