THROW THIS TO THAT

From Esolang
Jump to navigation Jump to search

Creator and Name

THROW THIS TO THAT is an esoteric language created by the User:Esolang1. This language is heavily based on FROM HERE TO THERE, with the exception of not being able to handle files. So, you can expect to see some similarities with the language FROM HERE TO THERE in this page. (E1-0003)

Code

Syntax

Each line of the source code should have a code with the following syntax:

   THROW A TO B

Similar to FROM HERE TO THERE, A and B can be a value, a line, a variable, or a special value marked below.

Special Values For Part: A

 "IN"            Getting input and storing it.
 "X"             Execute the rest if the code with variable sent.
 a string        Storing values to a variable, or printing out to OUT.
 an integer      Storing values to a variable, or printing out to OUT.
 a float         Storing values to a variable, or printing out to OUT.
 a boolean       Storing boolean to a variable, or printing out to OUT.
 a variable      Changing values, or printing out to OUT.
 a condition     Creating conditional statements, such as if or else if.

Special Values For Part: B

 "OUT"                     Printing out A.
 "LINE"                    Move to the code in line A.
 a variable                Declaring and initializing a variable.
 a variable expression     Changing the value of a variable. (Mentioned below.)
 an integer                Go to the line (inputted integer) with the value A.

Variables

Variable names are restricted to only use lowercase letters. This is because most of the code will be uppercase. Declaring a variable with the name "a" and initializing with the value "b" looks like this:

   THROW "b" TO a

Like FROM HERE TO THERE, use reverse-operation notation to perform math on variables. This code adds 3 to the variable a:

   THROW a TO a - 3

Subtract 3:

   THROW a TO a + 3

Multiply by 3:

   THROW a TO a / 3

Divide by 3:

   THROW a TO a * 3

I/O

Inputs and outputs are usable with the IN and OUT codes. Getting an input and storing to variable a:

   THROW IN TO a

Printing the variable a:

   THROW a TO OUT

Or shorter:

   THROW IN TO OUT

Examples

Hello, World!

   THROW "Hello, World!" TO OUT

Truth-machine

   THROW IN TO a
   THROW a == 0 TO 6
   THROW a == 1 TO 4
   THROW "1" TO OUT
   THROW 4 TO LINE
   THROW "0" TO OUT

Infinite cat

   THROW IN TO OUT
   THROW 1 TO LINE

Collatz sequence

   THROW IN TO A
   THROW A TO OUT
   THROW A % 2 != 0 TO 5
   THROW A TO A * 2
   THROW 8 TO LINE
   THROW A TO A / 3
   THROW A TO A - 1
   THROW A TO OUT
   THROW A != 1 TO 3

See also