Update Ground Types
@@ -1,7 +1,43 @@
|
||||
Ground has 5 built-in types, which all hold a different purpose.
|
||||
## Variable Types
|
||||
|
||||
Ground has 5 built-in types, which are all used to hold varying data.
|
||||
|
||||
- int: This stores a signed 64-bit integer. As CGround is written in C, integer overflow/underflow is **undefined behaviour**.
|
||||
|
||||
Examples: `46`, `-17`
|
||||
- double: This stores the same values as a C double, i.e. 1 bit sign, 11 bit exponent, 52 bit mantissa.
|
||||
- string: This stores an immutable sequence of characters, stored in memory as a `const char*`.
|
||||
- char: This stores a single character.
|
||||
|
||||
Examples: `0.5`, `-6.25`
|
||||
- string: This stores an immutable sequence of characters, stored in memory as a `const char*`. Notated with the string surrounded by the `"` symbol.
|
||||
|
||||
Example: `"Hello, world!"`
|
||||
- char: This stores a single character. Notated with the character surrounded by the `'` symbol.
|
||||
|
||||
Example: `'a'`, `' '` (space)
|
||||
- list: This stores an array of variables.
|
||||
|
||||
Example: `[2, -4, -1.5, "Hi!"]`
|
||||
|
||||
## Argument Types
|
||||
|
||||
Ground has _ different argument types, which are each used for different arguments in various commands.
|
||||
|
||||
- value (`$`): This gets the value of a variable.
|
||||
|
||||
Example: `println $var`
|
||||
|
||||
- direct (`&`): This gets the variable itself.
|
||||
|
||||
Example: `set &var 10`
|
||||
|
||||
- line (`%`): This is used to mark a label or line number
|
||||
|
||||
Example: `jump %label`
|
||||
|
||||
- function (`!`): This is used to mark a direct reference to a function
|
||||
|
||||
Example: `call !myFunction &output`
|
||||
|
||||
- type (`-`): This is used to mark a variable type
|
||||
|
||||
Example: `fun !myFunction -int` (returns an int)
|
||||
Reference in New Issue
Block a user