IWANNADIE

From Esolang
Jump to navigation Jump to search

IWANNADIE or IWD is an esoteric programming language created in 2021 by Antikore written in python, and it was inspired by assembly code and bash, with the goal to be as confusing as possible but avoiding the use of arbitrary letters and characters to do stuff. All programs must end with the command die, which is used to close the program. It's name comes from the concept that, if anyone uses this language, they don't love themselves pretty much.

Commands

Command Arguments Returns Description
set variable name, value null Sets a variable to a value, or defines it if doesn't exist.
add variable name or value, float float Adds the value to the variable, or to another value. The return is always the result of the addition. It's used to substract to, and the only way to get a variable's value, by adding 0.
mul variable name or value, float float Same as add, but multiplying
div variable name or value, float float Same as add, but dividing
mod variable name or value, value float Same as div, but returning the remainder
goto string null Moves to the marker
goif string, boolean null Moves to the marker if the value at the boolean is true, else, continue to next line
doif boolean null If the boolean is false, then the following line is skipped
comp/compare value, value boolean Checks if the first is bigger than the latter
check value, value boolean Checks if both values are equal
input string string Waits the user to input something, then return it
not/and/or boolean (not) / boolean, boolean (and, or) boolean Logical operators
len string integer Returns the length of the string
random float, float float Returns a random number between both values
floor float float Returns the given number floored to an integer form, however, the result is still in float type
round float float Returns the given number rounded to an integer form, however, the result is still in float type
char string, integer string Returns the character at index in a string
int float/string integer Convers the value given into an integer
text string, string string Returns both strings combined
die none null Exits the program

Examples

Hello, World!

print "Hello, World!"
die

Truth-machine

set #input, [input "Number >> "]
goif "zero", [check [add #input, 0], "0"]
@one
print "1"
goto "one"
@zero
print "0"
die

Factorial

set #num, 5
set #org, [add #num, 0]
set #res, [add #num, 0]
@factorial
add #num, -1
mul #res, [add #num, 0]
goif "result", [check [add #num, 0], 1]
goto "factorial"
@result
print [text [int [add #org, 0]], [text " is ", [int [add #res, 0]]]]
die

FizzBuzz

set #counter, 0
@counter
add #counter, 1
goif "fizzbuzz", [and [check [mod [add #counter, 0], 3], 0], [check [mod [add #counter, 0], 5], 0]]
goif "fizz", [check [mod [add #counter, 0], 3], 0]
goif "buzz", [check [mod [add #counter, 0], 5], 0]
print [int [add #counter, 0]]
goto "repeat"
@fizz
print "Fizz"
goto "repeat"
@buzz
print "Buzz"
goto "repeat"
@fizzbuzz
print "FizzBuzz"
@repeat
goif "counter", [not [check [add #counter, 0], 100]]
die

99 bottles of beer

set #bottles, 99
@alot
print " "
print [text [int [add #bottles, 0]], " bottles of beer on the wall"]
print [text [int [add #bottles, 0]], " bottles of beer"]
print "Take one down, pass it around"
add #bottles, -1
goif "one", [check [add #bottles, 0], 1]
print [text [int [add #bottles, 0]], " bottles of beer on the wall"]
goto "alot"
@one
print [text [int [add #bottles, 0]], " bottle of beer on the wall"]
print " "
print [text [int [add #bottles, 0]], " bottle of beer on the wall"]
print [text [int [add #bottles, 0]], " bottle of beer"]
print "Take one down, pass it around"
print "No bottles of beer on the wall."
die

Interpreter

iwannadie.py

The official interpreter can be found here

See also