~This=That

From Esolang
Jump to navigation Jump to search

This=That is an esoteric programming language by User:A, and is made up entirely of variables. Each line is just a case-sensitive variable name, followed by =, and then the variable's case-sensitive value.

The variable names can be anything including special names, and the values can be anything as well, and can also be special values:

\o prints the variable's value.
\i inputs a value for the variable to take.
+(add)
-(subtract)
/(divide)
*(multiply)
do math. For example:
    x=4
    J=x - 2

sets x as value 4 and J as value 2 (4-2). Also:

    f=n
    p=o
    s=f + p

sets fruit as value fly(Any value without 0-9 is a string), printer as value paper, and sticky as value no (word math only works with +).

x=cnd.? starts an if called x with the given condition.
x=cnd.: starts a while loop named x with the given condition.
x=& signifies the end of if or while loop called x.

Conditions have three parts, two compared values referenced by their names and a comparison. They only use 4 instructions, which can be:

> is greater than
< is less than
== equal to
~ NOT command.(Makes < into >=, > into <=, = into !=)

Example programs

Hello, world! Program

x=Hello, world!
x=\o

Cat Program (Until QUIT is inputted)

x=\i
y=~x==QUIT:
x=\o
x=\i
y=&

Endless Bottles of Beer Program

a=99
b= bottles of beer on the wall.  
c=a+b
d= bottles of beer.  You take one down and pass it around.  
e=a+d
f=c+e
g= bottle of beer on the wall.  
h=a+g
i= bottle of beer.  You take it down and pass it around.  
j=a+i
k=h+j
l= bottles of beer.  You go to the store and buy some more.  
m=a+l
n=c+m
o=0
x=o==0:
y=a>2:
f=\o
a=a-1
c=\o
y=&
f=\o
a=a-1
h=\o
k=\o
a=No
c=\o
n=\o
a=99
c=\o
x=&

Endless Fibonacci Program

a=0
b=1
a=\o
b=\o
x=b>0:
a=a+b
a=\o
b=a+b
b=\o
x=&

Endless Square Numbers Program

a=0
b=1
a=\o
x=b>0:
a=a+b
b=b+2
a=\o
x=&

or

a=0
x=~a<0:
b=a*a
b=\o
a=a+1
x=&

Simple Adding Machine

x=\i
y=\i
z=x+y
z=\o

Digital Root Calculator

a=\i
x=a>9:
a=a-9
x=&
a=\o

Counts down from inputed value to zero

a=\i
x=a>0:
a=\o
a=a-1
x=&

Counts from zero to infinity

a=0
x=a>0:
a=\o
a=a+1
x=&

See Also