We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Teacher

From Esolang
Jump to navigation Jump to search

Teacher is an esolang created by User:Anothaccount. It's themed around schools and teachers that yell at their students. In order to make your program run, you are required to make at least one variable and set it to a value.

Commands

Command Description
TIME FOR CLASS start program
(VARIABLE) Enters the school create variable
(VARIABLE) SAY YOUR NAME OR YOUR WILL BE EXPELLED print variable
(VARIABLE) SAY YOUR NAME OR YOUR WILL BE SUSPENDED print variable (in ascii)
(VARIABLE) SAY YOUR NAME TO THE CLASS print variable's name
(VARIABLE) WHAT IS YOUR NAME get input from user and put it in variable (as a number, or it won't work)
(VARIABLE) IS ABSENT SO HE WILL GET DETENTION Clear variable
(VARIABLE) YOU PASSED Increment variable
(VARIABLE) YOU FAILED Decrement variable
(VARIABLE) YOU GOT (NUMBER) POINTS ON THE TEST Increments variable by number
(VARIABLE) YOU HAVE (NUMBER) DAYS LEFT ON THE TEST Decrements variable by number
(VARIABLE) YOU GET (NUMBER) DAYS OFF FROM SCHOOL Multiplies variable by number
(VARIABLE) YOU GET (NUMBER) DAYS IN DETENTION Divides variable by number
(VARIABLE) GOOD JOB FOR PARTICIPATING IN CLASS Square variable
(VARIABLE) STOP PASSING OUT NOTES TO (VARIABLE 2) Sets a variable's value to another variable's value
(VARIALBE) IS (NUMBER) YEARS OLD set value in variable
(VARIABLE) SEE ME AFTER CLASS set variable to random value between 0 and 255
(VARIABLE) IF YOUR GRADE IS (LOWER THAN/HIGHER THAN/EXACTLY/NOT EXACTLY) ((NUMBER) PERCENT/(VARIABLE)'S SCORE) THEN start if condition
OR ELSE else condition
OR ELSE IF YOUR GRADE IS (LOWER THAN/HIGHER THAN/EXACTLY/NOT EXACTLY) ((NUMBER) PERCENT/(VARIABLE)'S SCORE) THEN else if condition
NOW SHOW ME YOUR GRADE end if condition
(VARIABLE) GO TO THE PRINCIPALS OFFICE NOW Deletes a variable
OK (VARIABLE) WHATS (NUMBER OR VARIABLE) PLUS (NUMBER OR VARIABLE) Sets a variable's value to a sum
OK (VARIABLE) WHATS (NUMBER OR VARIABLE) MINUS (NUMBER OR VARIABLE) Ditto, but subtraction
OK (VARIABLE) WHATS (NUMBER OR VARIABLE) TIMES (NUMBER OR VARIABLE) Ditto, but multiplication
OK (VARIABLE) WHATS (NUMBER OR VARIABLE) DIVIDED BY (NUMBER OR VARIABLE) Ditto, but division
*ONE ROLE CALL LATER* Prints out every variable's values in order of creation
*ONE PRESENTATION LATER* Prints out every variable's values in order of creation (ASCII)
*ONE PLEDGE OF ALLEGIANCE LATER* Prints out every variable's names in order of creation
*(NUMBER) SECONDS LATER* Waits for amount of seconds
*AFTER LUNCH* Increments every variable
*ONE FIRE DRILL LATER* Decrements every variable
WHO THREW THAT PAPER Chooses a random variable (condition)
NO MORE THROWING PAPER IN CLASS Ends random variable condition
TODAY YOU ALL HAVE HOMEWORK start loop
PLEASE TURN IN YOUR WORK end loop (it will only end once this line is reached and one of the vartiables in the loop is 0)
EVERYONE TELL ME YOUR NAMES get input from user and print it as a string
OK CLASS, (STRING) prints string
TODAYS ASSIGNMENT IS: (COMMENT) comment
*(COMMENT)* alternative comment
ALL OF YOU FAIL deletes every variable
CLASS IS DISMISSED end program

Examples

Hello, world!

TIME FOR CLASS
Ihavetocreatethisvariableoritwillthrowanerror Enters the school
Ihavetocreatethisvariableoritwillthrowanerror IS 0 YEARS OLD
OK CLASS, Hello, World!
CLASS IS DISMISSED

Cat program

TIME FOR CLASS
Cat Enters the school
Cat IS 0 YEARS OLD
EVERYONE TELL ME YOUR NAMES
CLASS IS DISMISSED

A+B Problem

TIME FOR CLASS
A Enters the school
B Enters the school
Sum Enters the school
A WHAT IS YOUR NAME
B WHAT IS YOUR NAME
OK Sum WHATS A PLUS B
Sum SAY YOUR NAME OR YOUR WILL BE EXPELLED
CLASS IS DISMISSED

XKCD Random Number

TIME FOR CLASS
RNG Enters the school
RNG IS 4 YEARS OLD
RNG SAY YOUR NAME OR YOUR WILL BE EXPELLED
CLASS IS DISMISSED

Example of using random variable condition

(This prints either 0 or 1 at random)

TIME FOR CLASS
Aliah Enters the school
Tim Enters the school
Aliah IS 48 YEARS OLD
Tim IS 49 YEARS OLD
WHO THREW THAT PAPER
SAY YOUR NAME OR YOUR WILL BE SUSPENDED
NO MORE THROWING PAPER IN CLASS
CLASS IS DISMISSED

Truth-machine

TIME FOR CLASS
Truth Enters the school
TODAYS ASSIGNMENT IS: Truth telling
Truth WHAT IS YOUR NAME
Truth IF YOUR GRADE IS EXACTLY 0 PERCENT THEN
Truth SAY YOUR NAME OR YOUR WILL BE EXPELLED
OR ELSE IF YOUR GRADE IS EXACTLY 1 PERCENT THEN
TODAY YOU ALL HAVE HOMEWORK
Truth SAY YOUR NAME OR YOUR WILL BE EXPELLED
PLEASE TURN IN YOUR WORK
NOW SHOW ME YOUR GRADE
CLASS IS DISMISSED

Fun Video Game

TIME FOR CLASS
Number Enters the school
Counting Enters the school
TODAYS ASSIGNMENT IS: Epic Gaming
Number IS 0 YEARS OLD
Counting IS 0 YEARS OLD
TODAY YOU ALL HAVE HOMEWORK
Number WHAT IS YOUR NAME
Number IF YOUR GRADE IS EXACTLY Counting'S SCORE THEN
Number YOU PASSED
Counting YOU PASSED
OR ELSE
OK CLASS, FAILURE
Number IS ABSENT SO HE WILL GET DETENTION
NOW SHOW ME YOUR GRADE
PLEASE TURN IN YOUR WORK
CLASS IS DISMISSED

Plushie-complete proof

Print 4

(See XKCD Random Number Example)

Print 31

TIME FOR CLASS
Plushie Enters the school
Plushie IS 31 YEARS OLD
Plushie SAY YOUR NAME OR YOUR WILL BE EXPELLED
CLASS IS DISMISSED

Store 2

TIME FOR CLASS
Store Enters the school
Store IS 2 YEARS OLD
CLASS IS DISMISSED

Errors

Reason Console log
No start of program Class never started
No end of program Class didn't dismiss properly
Command typo The teacher stuttered and the whole class laughed.
Two variables with the same name There was a doppelganger in the school.
No loop ending Students never turned in their work.
No loop start Students never got any homework.
No if ending Student never showed teacher their grade and got expelled.
Divide by 0 The entire school collapsed on itself.
Variable value over 64-bit integer limit Student delved into singularity.
Variable name that's not just letters Someone got made fun of and had to leave the school.
Value not set in variable One of the students never told them their name and got expelled.
No variables created The school never got any students and was abandoned.
More than 50 variables created The teacher had enough and quit his job.