From 00faeefa49ea4dbd599cf89ebaa1a2761de73340 Mon Sep 17 00:00:00 2001 From: DiamondNether90 Date: Thu, 8 Jan 2026 21:33:38 +1100 Subject: [PATCH] Update Ground Types --- Ground-Types.md | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/Ground-Types.md b/Ground-Types.md index e229be7..039551e 100644 --- a/Ground-Types.md +++ b/Ground-Types.md @@ -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. -- list: This stores an array of variables. \ No newline at end of file + +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) \ No newline at end of file