definition

From Esolang
Jump to navigation Jump to search

definition is a Python subset where you have to define a function to even run the program (variables, lists and dictionaries don't count, runing the first defined function is done automaticly)

Syntax

You have to define a function and put your code into that function:

def main():
 x=0; print(x)

Variables can be outside functions. But that makes the variable global

To disable it from entering a function, you just do this:

x=0
def main():
 print(x)
def main2():
 dont(x)
 print("x cannot enter this function")
run(main,main2)

And if the program finds out you have a variable in a function that has this variable disabled:

Line 6: Cannot use the disabled variable

And to make a local variable and add it to a function, do this:

def main():
 x=0; print(x)
def main2():
 do(x)
 print(f"{x=} value taken from the main function")
run(main,main2)

run is self-explanatory. It just runs functions on a list.

The input command is invalid since you can make input using the run command and arguments

Examples

Hello, world!

def m():print("Hello, world!")

Truth-machine

def truth(x):
 if x==0 or x=="":print(0)
 else:one()
def one():print(1);one()
run(truth("input"))

replace the "input" with your input