Tutorial Syntax - MarkyVasconcelos/cajuscript GitHub Wiki
#summary Overview on language syntax
=Syntax=
See too about [sampleSyntax custom syntax] and these proposals:
- [sampleSyntaxBasic Basic]
- [sampleSyntaxJava Java]
- [sampleSyntaxPortuguese Portuguese]
===[tutorialImportAndInclude Imports and include file]:===
{{{
// Import
===Variables:=== {{{ // Defining a new variable x = 0 x = "Programing 'Java' with CajuScript!" x = 'Programing "Java" with CajuScript!' x = "Programing "Java" with CajuScript!" x = 'Programing 'Java' with CajuScript!' x = StringBuffer(x) x.append(" "+ x) System.out.println(x.toString()) }}}
===[tutorialIf IF]:=== {{{ // IF x = 10 x < 10 & x > 0 ? System.out.println("X is less than 10!") ? x > 10 & x ! 10 ? System.out.println("X is greater than 10!") ? x = 10 ? System.out.println("X is 10!") ?? System.out.println("X is less than 1!") ? }}}
===[tutorialLoop LOOP]:=== {{{ // LOOP x = 0 x < 10 & x >= 0 @ System.out.println(x) x += 1 @ }}}
===[tutorialFunction FUNCTION]:=== {{{ // FUNCTION // Allowed: // addWithX v1, v2 # ... # // addWithX(v1 v2) # ... # x = 5 addWithX(v1, v2) # // "~" is the return ~ x + v1 + v2 # x = addWithX(10, 20) System.out.println("X = "+ x) }}}
===Null value:=== {{{ // $ is the null value x = $ }}}
===[tutorialArithmetic Arithmetic Operators]:=== {{{ // + Addition x = 0 + 1 x += 1
// - Subtraction
x = 0 - 1
x -= 1
// * Multiplication
x = 0 * 1
x *= 1
// / Division
x = 0 / 1
x /= 1
// % Modulus
x = 0 % 1
x %= 1
}}}
===[tutorialComparison Comparison Operators]:=== {{{ // = Equal to (x = y)
// ! Not equal to
(x ! y)
// < Less Than
(x < y)
// > Greater Than
(x > y)
// < Less Than or Equal To
(x <= y)
// > Greater Than or Equal To
(x >= y)
}}}
===[tutorialComment Comments allowed]:=== {{{ -- Comment...
// Comment...
\ Comment...
}}}
===[tutorialTryCatch Try/Catch]:=== {{{ // Try/Catch e ^ "".substring(0, -1) ^^ System.out.println("Error: "+ e.getMessage()) ^~^ System.out.println("Finally...") ^ }}}