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.

Hello++++++++++++++++++++++++++++++++++++

From Esolang
Jump to navigation Jump to search

Hello++++++++++++++++++++++++++++++++++++ or Hello36 is a Joke Language made by User:Dumgeonlol. Hello36 can do more than just print Hello World so it is useful (not really).

Stuff

Hello36 has a built-in variable called HI which allows you to calculate things (not really). It also has loops that will run while HI is not 0.

Commands

h - prints Hello World
H - same as h
Hello World - same as h
hw - same as h
wh - prints dlroW olleH
HI+ - increases HI by 1
HI- - decreases HI by 1
HI+10 - increases HI by 10
HI-10 - decreases HI by 10
sayNumHi - prints HI directly (as an integer)
sayCharHi - converts HI into an ASCII character (ascii table: https://www.asciitable.com/), then prints it
saveHItoStr - converts HI to an ASCII character, then adds it to a built-in variable called HIstr
sayHIstr - prints HIstr
hey - starts a loop if HI is not 0 and skips the loop if HI is 0
cya - ends the loop if HI is 0 and loops back if HI isn't 0

Running

For the JavaScript interpreter down below, to run Hello 36, you must make a .hi file and type: runhello [filepath].

Interpreters

This is an interpreter written in JavaScript by User:Dumgeonlol

const fs = require('fs');
const path = require('path');
const readline = require('readline');

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

console.log("Hello++++++++++++++++++++++++++++++++++++ Interpreter Started!");
console.log("Type 'runhello [filepath]' to execute a file, or 'exit' to quit.\n");

function runHelloFile(filePath) {
    if (path.extname(filePath) !== '.hi') {
        console.error("Error: File must have a .hi extension.\n");
        return;
    }

    try {
        const fileContent = fs.readFileSync(filePath, 'utf-8');
        const lines = fileContent.split(/\r?\n/);

        let isProgramRunning = false;
        let HI = 0;
        let HIstr = "";

        for (let i = 0; i < lines.length; i++) {
            const command = lines[i].trim();

            if (command === "") continue;

            if (command === "HELLO") {
                isProgramRunning = true;
                continue;
            }

            if (command === "GOODBYE") {
                isProgramRunning = false;
                break;
            }

            if (isProgramRunning) {
                if (command === "h" || command === "H" || command === '"Hello World"' || command === "hw") {
                    console.log("Hello World");
                } 
                else if (command === "wh") {
                    console.log("dlroW olleH");
                } 
                else if (command === "hHI") {
                    console.log(Array(HI).fill("Hello World").join('\n'));
                } 
                else if (command === "whHI") {
                    console.log(Array(HI).fill("dlroW olleH").join('\n'));
                }
                else if (command === "HI+") {
                    HI += 1;
                }
                else if (command === "HI-") {
                    HI -= 1;
                }
                else if (command === "HI+10") {
                    HI += 10;
                }
                else if (command === "HI-10") {
                    HI -= 10;
                }
                else if (command === "sayNumHI") {
                    console.log(HI);
                }
                else if (command === "sayCharHI") {
                    console.log(String.fromCharCode(HI));
                }
                else if (command === "saveHItoStr") {
                    HIstr += String.fromCharCode(HI);
                }
                else if (command === "sayHIstr") {
                    console.log(HIstr);
                }
                else if (command === "hey") {
                    if (HI === 0) {
                        let count = 1;
                        while (count > 0 && i < lines.length - 1) {
                            i++;
                            const nextCmd = lines[i].trim();
                            if (nextCmd === "hey") count++;
                            if (nextCmd === "cya") count--;
                        }
                    }
                }
                else if (command === "cya") {
                    if (HI !== 0) {
                        let count = 1;
                        while (count > 0 && i > 0) {
                            i--;
                            const prevCmd = lines[i].trim();
                            if (prevCmd === "cya") count++;
                            if (prevCmd === "hey") count--;
                        }
                    }
                }
                else {
                    console.log(command);
                }
            }
        }
        console.log("");

    } catch (error) {
        if (error.code === 'ENOENT') {
            console.error(`Error: Could not find file '${filePath}'\n`);
        } else {
            console.error("An error occurred:", error.message, "\n");
        }
    }
}

function promptUser() {
    rl.question('> ', (input) => {
        const trimmedInput = input.trim();

        if (trimmedInput.toLowerCase() === 'exit') {
            rl.close();
            return;
        }

        if (trimmedInput.startsWith('runhello ')) {
            const filePath = trimmedInput.replace('runhello ', '').trim();
            runHelloFile(filePath);
        } else {
            console.log("Unknown command. Use: runhello [filepath]\n");
        }

        promptUser();
    });
}

promptUser();

Predecessors