|Type system||dynamic, weak|
|Influenced by||BASIC, Python|
GotoScript supports strings, integers, and floats. Boolean values are represented with 0s (
False) and 1s (
All lines containing code must begin with a unique label so that they can be referred to later in the program. Labels may be any data type. For example, in the following line,
'print' is the label:
'print' PRINT 'Hello, world!'
Input and output
- outputs a message to the console.
- outputs a message to the console with variable placeholders surrounded by curly braces.
- retrieves user input with an optional prompt.
- clears all output in the console.
- jumps to the line with a given label.
GOTOthat runs if a given condition is true.
GOTOthat runs the first time the given condition becomes true.
GOTOthat runs whenever the given condition becomes true.
GOTOthat jumps to another line if an error occurs on the first one.
- stores the number of
GOTOs that have run in the program so far.
- stores the error stopped by the last
||subtraction, string removal|
||multiplication, string duplication|
Quitoan notation is the operator notation utilized in GotoScript, which it is unique to. In Quitoan notation, expressions are written as a series of expressions that build off each other, separated by commas. Previous expressions in the series can be referenced with automatically-assigning variables from lowercase a to z. As such, when declaring one-letter global variable names, it is advised to make them uppercase as to not override these local variables.
Quitoan notation has several advantages over standard infix notation. The most prominent is that, by reducing complex expressions into a list of smaller steps to perform and eliminating parentheses, Quitoan notation is often easier to read and understand. The second is that, with the use of the automatic variables, repeated parts of an expression can be combined. These two advantages are noticeable in the below examples:
(2 + 3) * 2becomes
2 + 3, a * 2.
((4 + 4) * (4 + 4 - 2)) ^ 2becomes
4 + 4, a - 2, a * b, c ^ 2.
x * (2 - (8/9 ^ n) ^ 2)becomes
8/9 ^ n, 2 - a ^ 2, x * b.
((A & B) | (C & D)) & !(E | F)becomes
A & B, C & D, E | F, a | b & !c.
- Comments are denoted with a hashtag (
- String indexing and slicing are done like in Python.
- Multiple assignments (
a := b := c) and chained comparisons (
a = b <= c) are supported.
GotoScript is almost surely Turing-complete as the Rule 110 automaton could feasibly be written in it. GotoScript possesses all the features required for the task: variables, indexing, conditions, and loops (albeit unconventional ones at that).
- "Now this, this is epic." - Quito0567's friend, OhNoman1259
- "Wow." - Quito0567's cousin
- The first version of GotoScript.
- Added the built-in
- Added the containment operator (
- Added the
PRINTF(formatted print) command.
- GotoScript switches from Infix to Quitoan notation, which Quito0567 invented earlier that day.
- Added the
1 PRINT INPUT
1 PRINT '*' * GOTOS + '*' 2 GOTO 1
# Get input 1 GOTO 4 IF INPUT = 0 # Print 1 infinitely 2 PRINT 1 3 GOTO 2 # Print 0 4 PRINT 0
# Get input 1 n := max := INPUT # Factorial operation 2 n *= GOTOS + 1 # End loop 3 GOTO 5 IF GOTOS >= max - 2 # Continue loop 4 GOTO 2 # Output 5 PRINT n
Print the first n Fibonacci numbers
1 n := INPUT 2 a := 0 3 b := 1 4 c := a + b 5 a := b 6 b := c 7 PRINT b 8 GOTO 4 IF GOTOS < n - 1
# Variables 1 max := 100 2 n := 0 3 to_print := "" # Conditionals 4 GOTO 8 IF n % 15 = 0 5 GOTO 9 IF n % 3 = 0 6 GOTO 10 IF n % 5 = 0 # Print options 7 to_print := n 8 to_print := 'FizzBuzz' 9 to_print := 'Fizz' 10 to_print := 'Buzz' # Output 11 GOTO 12 WHEN to_print != "" 12 PRINT to_print # Continue loop 13 n += 1 14 GOTO 3 # End loop 15 GOTO WHEN n > max
As shown below, the usage of possible inputs (in this case, Deadfish commands) as labels is a clever way to shorten GotoScript code. It's like match-case in Python or a switch statement in Java.
# Variables 1 x := 0 2 new_x := "" # Reset accumulator on under/overflow 3 GOTO 1 IF x < 0 | x = 256 # Get input 4 GOTO INPUT '>> ' CATCH 5 # Invalid input 5 PRINT 'Invalid command.' # Increment 'i' new_x := x + 1 # Decrement 'd' new_x := x - 1 # Square 's' new_x := x * x # Output 'o' PRINT x 6 GOTO 4 # Loop back 7 GOTO 2 WHEN new_x != ""