+Output

From Esolang
Jump to navigation Jump to search

+Output is exactly the same as -Output, however there is now an output command. Everything else is still the same, and all -Output programs are compatible with +Output. Read -Output for the basic idea.

New instruction

op Values popped Description
o x Outputs x to the standard output.

That's it. There only needs to be one output command.

Examples

Hello, world!

"Hello, world!" o X

A + B problem & string concatenation

in in + o X

Input numbers to add them, input strings to concatenate them, input different types to get an error.

Truth-machine

in #v_0o X
  v1<
  >o^

Cat program

Loops until an empty string is provided.

>i:#v_X
^ o <

Cat program 2

This one is a one-time use.

ioX

It's pretty simple.

Add or subtract

Type sub to subtract, anything else to add. Inputs are done in this order: num1, num2, operation (aka reverse Polish notation).

ininv
v   <
>i"sub"=#v_+oX
      Xo-<

Is greater than

Takes 2 inputs, and outputs whether the first is greater or less than the second. Inputting strings will use their length, so this doubles as a length comparator.

ii`#v_"Is less than or equal to"v
    >"Is greater than"oX      Xo<

Number or string checker

Takes an input, and outputs whether it's a string or a number.

it#v_"Number">oX
   >"String" ^

Hi interpreter

il"hi"*oX

A quick look at the categories and you should know that I haven't tested these, because I couldn't. This means all programs are uncertain if they work or not.