Creation/Dev/GScript3: Difference between revisions
(Created page with 'Category:Scripting Reference '''GScript3''' is the latest version of the Graal's scripting language.<br/> It introduces new syntax and semantic eleme…') |
|||
Line 29: | Line 29: | ||
''numeric_expression1'' '''=''' ''numeric_expression1'' '''+''' ''numeric_expression2'' | ''numeric_expression1'' '''=''' ''numeric_expression1'' '''+''' ''numeric_expression2'' | ||
To concatenate strings, the [[#append assignment ( | To concatenate strings, the [[#append assignment (@=) operator|append assignment (@=) operator]] must be used instead. | ||
'''Example''' | '''Example''' |
Revision as of 08:42, 5 June 2013
GScript3 is the latest version of the Graal's scripting language.
It introduces new syntax and semantic elements, and enable new features in Web browsers.
Language Elements
Operators
addition (+) operator
Usage
numeric_expression1 + numeric_expression2
Adds together numeric_expression1 and numeric_expression2.
Both expressions must be numeric (int or number types).
To concatenate strings, the append (@) operator must be used instead.
Example
echo(1 + 2); // 3 echo(1.5 + 2.25); // 3.75
addition assignment (+=) operator
Usage
numeric_expression1 += numeric_expression2
Puts the result of numeric_expression1 + numeric_expression2 into numeric_expression1.
Both expressions must be numeric (int or number types).
This is a direct equivalent of the following expression:
numeric_expression1 = numeric_expression1 + numeric_expression2
To concatenate strings, the append assignment (@=) operator must be used instead.
Example
var result : int = 10; result += 20; echo(result); // 30
append (@) operator
Usage
string_expression1 @ string_expression2
Concats together string_expression1 and string_expression2.
Both expressions must be string (string type).
To add numbers, the addition (+) operator must be used instead.
Example
echo("hello " @ "world"); // "hello world"