esolang

Output

Two statements. Input reads a line, and Output prints a string, that line, or the whole program.

None1, 2023 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 4 known programs · Test method

Run it

Expected: Hello World!

The idea

None1 made Output in 2023 as a language that can do almost nothing but print. It has no variables beyond the last line read and no loops, so every program runs once from top to bottom. Its one luxury is a built-in value for its own source code, which makes the cheating quine a single line.

The machine

LineDoes
InputRead one line of input
Output "text"Print the text
Output the inputPrint the last line read, or nothing if there was none
Output the program's source codePrint the whole program

Nothing adds a line break. Any other value after Output is a syntax error that stops the run; any other line is ignored. This follows the Python interpreter, which trims each line and reads all of the program before it starts.

Example

With n lines that each print the source, the output is the n lines n times over, which is the n² program.
Expected: cat
Expected: Output the program's source code

With n lines that each print the source, the output is the n lines n times over, which is the n² program.

Further

Ideas it shows

Pseudonatural

Write your own in Run Convert a program from Output

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: output.

Command line

shib run output -e 'Output "Hello World!"'
shib manual output

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/output.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org