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.

xg

From Esolang
Jump to navigation Jump to search

xg is a stack-based esolang by User:If. xg has 10 commands

Command Description
1g Output top of stack.
2g Add the top two values and push the result onto the stack. If there are fewer than two values on the stack, do nothing.
3g Subtract the top two values and push the result onto the stack. If there are fewer than two values on the stack, do nothing.
4g Multiply the top two values and push the result onto the stack. If there are fewer than two values on the stack, do nothing.
5g Divide the top two values and push the result onto the stack. If there are fewer than two values on the stack, do nothing.
6g Execute the next command only if the top value on the stack is zero.
7g If the top value on the stack is zero, jump to the corresponding 8g.
8g If the top value on the stack is not zero, jump to the corresponding 7g.
9g Push 1 onto the stack.
0g End the program.

Any other commands is ignored.

Examples

Print "4"

9g 9g 2g 2g 9g 2g 1g