Whenever
Jump to navigation
Jump to search
- This article is not detailed enough and needs to be expanded. Please help us by adding some more information.
Whenever is an esoteric programming language by David Morgan-Mar, with no sense of urgency. The program code is like a to-do list: the interpreter is free to execute statements in any order it chooses. However, a line may contain a clause specifying that it cannot be executed until certain conditions are true. There are no control flow structures or variables.
Syntax
Whenever code must include line-numbers manually typed by the user.
So,
1 1#9;
is valid, however,
1#9;
is invalid.
Commands
The following is a list of all valid Whenever commands.
(linenumber)#(numberoftimestoaddorremove) - variable definition (linenumber)#read() - variable definition with the value of the user input print() - Self explanatory
Compound statements:
defer((linenumber)) - will ignore the line containing "defer()" unless if the linenumber is executed again() ; forget() ;
Built-in functions:
N() U()
Math
Built in operators:
+ - * / == && || !
Examples
Hello, world!
1 print("Hello, world!");
If you want to print "Hello, world!" in two lines for some reason, Do this:
1 print("Hello,"); 2 defer(1) print("world!");
Calculator
1 defer(true) 0; 2 defer(true) 0; 3 defer(true) 0; 4 1#read(); 5 defer(4) 2#read(); 6 defer(5) 3#read(); 7 defer(N(2) != 44 || 6) print(N(1) + N(3) + -2); 8 defer(N(2) != 46 || 6) print(N(1) - N(3)); 9 defer(N(2) != 43 || 6) print((N(1) - 1)*(N(3) - 1)); 10 defer(N(2)!= 48 || 6) print((N(1) - 1)/(N(3) - 1));