From c9310f4121375db70f5198557a12f72a9b776f75 Mon Sep 17 00:00:00 2001 From: DiamondNether90 Date: Fri, 9 Jan 2026 08:49:04 +1100 Subject: [PATCH] Add End Keyword --- End-Keyword.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 End-Keyword.md diff --git a/End-Keyword.md b/End-Keyword.md new file mode 100644 index 0000000..0464db4 --- /dev/null +++ b/End-Keyword.md @@ -0,0 +1,23 @@ +Keyword: `end` + +Syntax: `end $int` + +Time Complexity: + +## Overview +The `end` keyword exits the program, returning an error status code to the OS. The argument is the status code returned. + +## Example usage +To cleanly end a program, add `end 0` to the end of a script. (0 means the program successfully completed with no errors). +```grnd +# main code +end 0 +``` + +If there was some sort of error, use a different exit status code. +```grnd +if $wasError %error # if there was an error, jump to @error +end 0 # if it didn't jump (i.e. no error), exit with status code 0 +@error +end 1 # if there was an error, exit with status code 1 +``` \ No newline at end of file