We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Condition

From Esolang
Jump to navigation Jump to search

Condition is an If a==1: derivative with added features, created as it was viewed as too restrictive and that things such as I/O would be useful for the language.

Syntax

Like the original language, all instructions are on a singular line. Unlike the original language, there are 2 variables: w and x. They can be of any integer value between 0 and 256. The language was made to be backwards-compatible with any original program, hence the original characters keep their meanings and w serves as a default variable if none is specified.

Instructions

Condition Instructions
Character Action
+ Increment
- Decrement
. Print
, Put user input
> Jump back by whatever value is in w
< Jump forwards by whatever value is in w

Interpreter

w = 0
x = 0
y = 0
for c in input():
    if c == ".":
        if c + 1 == "x":
            print(x)
            c += 1
        elif c + 1 == "w":
            print(w)
            c += 1
        else:
            print(w)
    if c == "+":
        if c + 1 == "x":
            x += 1
            c += 1
        elif c + 1 == "w":
            w += 1
            c += 1
        else:
            w += 1
    if c == "-":
        if c + 1 == "x":
            x -= 1
            c += 1
        elif c + 1 == "w":
            w -= 1
            c += 1
        else:
            w -= 1
    if c == ",":
        if c + 1 == "x":
            x = int(input())
            c += 1
        elif c + 1 == "w":
            w = int(input())
            c += 1
        else:
            w = int(input())
    if c == ">":
        c += w
    if c == "<":
        c -= w
if w == 1:
    break
if w != 1
    print("ERR:", w)
    break