Wiki
add tag
Community
Input and output is allowed using any of the below methods. Even mixing and matching input/output methods is allowed. If an input isn't needed, you need not accept it at all, that is, you don't need to provide a method for its input only to ignore it.
[toc]
## Normal methods
1. **Using streams like stdin, stdout, and stderr,** even from functions.
1. **Using return values,** even from functions.
1. **Using arguments in functions.**
1. **Using files as input/output,** even from functions.
1. **Using the screen for input/output** by any means, e.g. GUI prompts and GUI alerts, and terminals.
1. **Taking a black-box function as an argument.**
1. **Using command line flags/arguments for input,** e.g. `lang -arg=42 myprogram`

## Allowed assumptions
1. **Using predefined memory addresses/registers for input/output** in assembly programs with no well-defined streams.
1. **Hard-coding input for languages without any other input method.** Please specify where the input should be inserted.
1. **Taking input from a named table** in a query language. Please specify the table name.
1. **Assuming a specific name to receive a black-box function.**
1. **Using specific cells** in spread-sheet managers like Excel.

## Errors
1. **Throwing various exceptions types** if catchable with separate code for each exception type.
1. **Throwing various exception values** if the error value can be caught and read.
1. **Returning false/true by crashing/throwing or not.** If this can be caught or an exit code can be read.
1. **Answering true/false through success of compilation,** for meta-programming languages like C++ templates.

## Substitutions
1. **Using 0-based or 1-based indexing** for tasks involivng finding the *n*th term of a sequence.
1. **Using a character to receive an integer** corresponding to the character's code.
1. **Interchanging digit strings, lists of integers 0-9, and numbers,** e.g. `"42"`, `[4,2]` and `42`, as long as it is done consistently.
1. **Interchanging `[array shape,flat data]` and a multi-dimensional array,** e.g. `[[2,3],[1,2,3,4,5,6]]` vs `[[1,2,3],[4,5,6]]`.
1. **Interchanging multi-line strings and lists of strings,** e.g. `"hello\nworld"` vs `["hello","world"]`.
1. **Returning a number or Boolean as a list of matches,** so "no matches would be false or 0, while "one match" would be true or 1, etc,
1. **Interchanging a single value and a 1-element containing the value.**
1. **Interchanging types of multi-dimensional/nested data,** e.g. multi-dimensional arrays vs lists of lists.

## Language-specific rules
1. **Using the language standard in lieu of a specific type,** e.g. null-terminated arrays for TIS-100.
1. **Turing machines may output by varying their halt states.**
1. **Modifying arguments or designated "out" variables.**
1. **Using the "last value" as input,** e.g. `Ans` in TI-Basic and `_` in Python REPL.
1. **Using GET/POST parameters as input** in CGI scripts.
1. **Using `DATA`/`READ` for input.** This applies to various BASIC dialects.
1. **Returning through a list of matched strings** when using a regex.
1. **Returning through a specific capture group** from a regex. Please specify which one — it doesn't have to be number 0.
1. **Using transceivers for input/output** on an FPGA.
1. **Using a begin pointer and a length or an end pointer to represent an array** where this is natural. Especially of interest to C/C++/C#.
1. **Using bit-serial or 8-bit parallel input/output** with a clock and enable signal. HDLs might want to do this.
1. **Using stacks/tapes for input/output** in a stack-based or Turing machine language.
1. **Using currying to take multiple arguments.**

## Roundabout methods
1. **Using a callback function's output as input.**
1. **Invoking a function or event to return.**
1. **Using the clipboard for input/output.**
1. **Output via the exit code,** even from functions.
1. **Being a generator rather than returning a list.**
1. **Outputting via the return value,** even for a program.
1. **Answering a Boolean value by outputting something or staying silent.**
1. **Wrapping the result in a type wrapper.**
1. **Returning a promise that holds the result value,** but the time to resolve the promise must be counted in time-based competitions, and the result must be directly extractable without further processing.
1. **Returning a function which returns the result** when called with a dummy argument if needed.

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.