function x(y)

From Esolang
Jump to navigation Jump to search

function x(y) is a language created by User:PythonshellDebugwindow.


function x(y) uses strings (example: "Hello World") and integers (example: 123 or -456).


To start a function:

function x()


function x(y)

Or it can have as many arguments as you like:

function x(a, b, c, d, e, f, g)

Default values:

function f(requiredParameter, optionalParameter | defaultValue)

To print with a newline:


To print without a newline:


To get user input:


To get a live user input character:


To do math (must use spaces before and after the operator used) (+, -, *, or / (integer division), here + is shown), and there are only infix operators:

a + b

Math in function x(y) uses BDMAS (shortened version of BEDMAS) by default, but you can also uses parentheses for grouping, so the following:

a + b * c

would evaluate to a + (b * c), but for (a + b) * c:

(a + b) * c

To do comparison (must use spaces before and after the operator used) (<, >, <=, =>, ==, or !=, here == is shown):

a == b

Ternary (no spaces before/after the < or >):

condition<valueIfTrue, valueIfFalse>

To call a function:




Or with as many arguments as the function takes:

x(a, b, c, d, e, f, g)

To call a function recursively:


To return (default return value is 0):

-> a

To create a variable inside a function:

var v: a

To access that variable:


To set that variable:

v; a

To use compound assignment (+=, -=, *=, and /= in C, but in function x(y) +&, -&, *&, and /& respectively, here +& is shown):

v +& a

Comment until End of Line:

someCode # Comment


Execution starts at the first function in the program, which is passed no arguments.


Hello, World!

function helloWorld()
["Hello, World!"]


function cat()

Absolute value function

function abs(n)
-> (n < 0)<0 - n, n>

Factorial function

function factorial(n)
-> (n < 2)<1, n * {n - 1}>


function fizzbuzz(n | 0)
(n != 100)<((fizz(n) + buzz(n)) == "")<[n], printAndRecurse(n)>

function fizz(n)
-> ((n // 3) * 3 == n)<"Fizz", "">

function buzz(n)
-> ((n // 5) * 5 == n)<"Buzz", "">

function printAndRecurse(n)
[fizz(n) + buzz(n)]
fizzbuzz(n + 1)

Fibonacci sequence

function fib(acc | 0, num | 1)
-> fib(num, num + acc)