One Command Programming Language(OCPL)

From Esolang
Jump to navigation Jump to search
Not to be confused with OCPL, a.k.a.: One Character Programming Language.

One Command Programming Language is a programming language that uses only one command, !().

If there is one argument, like this, !(1), it will print what is inside.

!("Hello, World!") // prints Hello, World.

If there are two arguments, it will become a variable.

!(name, value).
!("x", 4)

Also, you can put a list in there

!("List", [0,1,2])

If there are three arguments, it will become a function.

!(name, arguments, code)
!("HelloWorld", null, !("Hello, World!"))

If there are four arguments, it will become an if.

!(condition, true, else, finally)
!("x>0", !("x is bigger than 0"), !("x isn't bigger than 0"), !("this always shows"))

If there are five arguments, it will become while.

!(condition, code, null, null, null)
!("x<0", !("x", "x - 1"),  null, null, null)

If there are six arguments, add another thing to the list.

!(Listname, item, null, null, null, null)
!("x", 1, null, null, null, null)

If there are seven arguments, it will activate the function

!(FunctionName, argument, null, null, null, null, null)
!("HelloWorld", 1, null, null, null, null, null)

Examples

multiplication table

!("x", 1)
!("x=9", 
    !("y", 1)
    !("y=9", 
        !(y + " * " + x + " = " + x*y + " ")
    , null, null, null)
    !("x", "x - 1")
, null, null, null)