H+Q9

From Esolang
Jump to navigation Jump to search

H+Q9 is a derivative of HQ9+ invented by User:None1. The characters are the same while the meanings of the characters are different.

H: Halt.

Q: Quit.

9: Output next character 9 times and halt.

+: Output next character once and halt.

Examples

Quine

999999999

XKCD Random Number

+4

NOP

Q

or

H

or simply


Screamer (only for 9 times)

9A

prints

AAAAAAAAA

Cheating Hello, world!

+問+天+地+好+在H

Notice

After creating this esolang, the author noticed that it isn't that useless after all. The esolang supports printing any character once or 9 times, allowing more powerful programs than HQ9+.

Interpreter

C

#include<stdio.h>
int main(){
    char c=getchar();
    if(c=='9'){
        c=getchar();
        printf("%c%c%c%c%c%c%c%c%c",c,c,c,c,c,c,c,c,c);
    }else if(c=='+') putchar(getchar());
    return 0;
}

Try it online!