Skip to main content

Variables and operators

Variables

It is not necessary to declare the types of your variables in a George Script. For instance, you can write the two lines below....

MyNumber=10
Answer=false

...in a script without declaring that the variable MyNumber is numeric or the variable Answer is boolean.

info

As for commands and instructions, the George language sees no difference between uppercase and lowercase letters. For instance, MyNumber, MYNUMBER, MyNuMbEr are all exactly the same variable.

warning

The George language use a few reserved variables in order to work correctly. You can use them as you wish, but it is not advised to modify them. That is the case with the two variables Time and Result (encountered in the clock.grg script above) which contains respectively the current time and the results of the last used TVP Animation command.

Operators

Arithmetic operators and examples

-negative: 18 -> -18
**exponent: 18**3=18*18*18=5832
*multiplication: 18*3=54
/division: 18/3=6
+addition: 18+23=21
-subtraction: 18-6=12

Logic operators and examples

&& and: a&&b
|| or: a||b

Relational operators and examples

==equal: x==6 , x==x+2
!=not equal to: x!=5 , x!y-3
>greater than: x>4 , x>y-z
>=greater or equal than: x>=3 , x>=z+/y
<less than: x<8 , x<-y
<=less or equal than: x<=7 , x<=x+5

The "=" operator is an assignment operator and allows to assign a given value to the variable of your choice. For example :

MyNumberOfLayers=5

The "==" operator is an comparison operator between two variables, usually used during conditional tests. For example :

if a==5

The comparison operator is not appropriate if want to know if two non numerical variables are equal. For this, you need to use the instruction cmp, as shown in the clock.grg script above :

if cmp(command,"Circle")==0