Click or drag to resize

Variables declaration and use

GoManga MathStudio Language offers dynamic type of variables. This means that you don't have to declare variable types when you declare a variable and MathStudio is a non-typed language.

Declaration

To declare a variable, just put its name inside square brackets and then do the assignament. For example:

//Numbers:
[Var] = 34
[Var] = 3.24

//Strings and chars
[Var] = e
[Var] = Hello

In GoManga MathStudio, types are dynamically managed, so you don't have to do casting and type declaration.

Operations

You can manipulate variables with operations between numbers and strings. To refer to a variable value, put its name inside braces. For example:

//Numbers operations:
[a] = 4
[b] = 2.12
[c] = calc {a} + {b}
//in this case, the variable "c" value will be "6.12"

//Strings operations:
[a] = 4
[b] = 2.12
[c] = {a} + {b}
//in this case the variable "c" value will be "4 + 2.12"

Note that to do numerical operations you have to put the calc keyword before the operation, otherwise, the operation will be treated as a string operation. You can also use compressed operations. For example:

//Equals to [a] = calc {a} + 1
[a]++

//Equals to [a] = calc {a} - 1
[a]--

//Equals to [a] = calc {a} + {b}
[a] += {b}

//Equals to [a] = calc {a} - {b}
[a] -= {b}

//Equals to [a] = calc {a} * {b}
[a] *= {b}

//Equals to [a] = calc {a} / {b}
[a] /= {b}