# Default for Code Golf: Input/Output methods

It looks like we have a consensus that we want certain defaults for the format which answers are expected in for . On that poll, the question arose twice, which input/output formats should be allowed for programs and functions.

So here is another poll. This one works different though. All the input/output methods are independent of each other, so there will be one answer per method. Upvote all you think are reasonable for the default. Downvote those which you think shouldn't be allowed unless the OP explicitly permits them.

To keep this remotely manageable, I have not posted individual answers for all possible inputs for functions. So there are only four: functions can take input/output via their arguments and return values. Or functions can use any method full programs can. I don't think there is any point in (say) allowing programs to take input from STDIN (only) and to allow functions to take input from ARGV (only) or something like that. If you disagree, please leave a comment.

Note: Some votes have been reverted because they were detected as serial voting. If you vote on multiple answers, please leave some time between votes.

A method is allowed if it has 5 net votes and at least twice as many upvotes as downvotes.

### Update

The current results of the polls are now part of the tag wiki. Please notify me, if results change significantly and the wiki should be amended.

• Related (Can numeric input/output be in the form of byte values) Dec 13, 2016 at 16:10
• "The current results of the polls are now part of the tag wiki" which tag wiki? meta wiki has nothing for code-golf tag. ppcg wiki has codegolf.stackexchange.com/tags/code-golf/info but it's missing a lot of answers here. Jul 18, 2018 at 18:17

# Submissions may use list of strings instead of multi-line strings

Input or output may be the equivalent of the string separated by newlines. For example, the multiline string:

1
2
Fizz
4
Buzz


May be instead be taken as a list of strings like:

["1","2","Fizz","4","Buzz"]

• I always see comments about this in multiline challenges, so I thought I'd throw this up there and see if it is well-recieved as a standard form of input
– Jo King Mod
Nov 13, 2018 at 11:54
• I would add an exception for ascii-art as linebreaks can be an important part of those challenges. Nov 19, 2018 at 19:43

# Functions may return their result in an optional type wrapper

By "optional type wrapper" I mean something like Maybe a in Haskell, Option<T> in Rust, etc.

The consensus was that this should be allowed because it functions like a singleton wrapper, or like a possibly-erroring function that never actually errors.

# Assembly programs may write output to registers

If there are no I/O devices available, an answer might consist of a subroutine that leaves its computed output values in the machine registers upon returning.

• Most calling conventions return integer values in a register, so this is eminently sensible for code fragments and functions. Jan 1, 2017 at 7:12
• This needs clarification: can we use any register, or only the ones that would be specified to be used by the ABI?
– user62131
Jun 11, 2017 at 4:14
• This answer is A, yours is B. Jun 20, 2017 at 2:15
• @user62131: in real-life hand-written assembly language, you do sometimes write helper functions with a totally custom calling convention that return multiple values in registers that are convenient. i.e. in asm and machine-code answers, you can invent any reasonable calling convention for your function. See my calling-convention answer on Tips for golfing in x86/x64 machine code Oct 8, 2019 at 18:06

# I/O for sequence questions may either be 0-indexed or 1-indexed

Any question that has the user output the $$\n\$$th term, first $$\n\$$ terms, etc. of a sequence should allow programs to index the first element of the sequence as 0 or 1 at the answerer's choice, as long as the program is consistent.

• This is now allowed by the sequence tag default. Jul 18, 2019 at 20:44

# Full programs may take array/string input (of unknown length) via stdin in the form of <length> <contents> or <contents> <sentinel>

EOF handling is a common problem in many languages, not just esolangs. But only "regular" languages that support proper arrays and functions can circumvent this issue by writing functions instead of full programs.

Most programming contest problems (which only support stdin/stdout as I/O) solve this issue by giving extra information in the standard input in one of the two ways:

• give "how many items you need to expect in the input" in the standard input itself, before the start of the actual content, or
• give a special value at the end of input so that you can "terminate the program when this value is entered".

I believe these solutions are also a natural extension of

to full programs respectively, which currently only apply to functions.

The same condition for the sentinel value applies when the sentinel value method is used:

It should be noted that the sentinel value must be the one that is guaranteed to not appear in any valid input [...], since their presence breaks the premise of the I/O method.

# CGI scripts may take input via GET/POST parameters

A CGI script required to take, e.g., three inputs can be expected to be called as the GET request

GET script.cgi?<A>=<1st input>&<B>=<2nd input>&<C>=<3rd input> HTTP/1.1


(where A, B and C are keys of the poster's choice) of the equivalent POST request.

• Also, PHP<5.4.0 (exclude) has the directive register_globals (enabled by default up to PHP4.1), which allows you to use POST, GET, COOKIE, SESSION and what-not. It creates the variables with the names of the keys (E.g.: a.php?a=1 would create $_GET[a] (version-dependent) and the variable $a with value 1). This was removed due to security reasons, but was a standard feature that was (fortunally) removed. Nov 27, 2015 at 17:52
• Also, would parse_str($_SERVER[QUERY_STRING]) be a valid input method? It does exactly the same as register_globals, but reads input parameters from a superglobal and parse them into variables. This is explained in the documentation: php.net/manual/en/function.parse-str.php Nov 27, 2015 at 18:01 • This proposed a specific input method. What language features you use to access that input is up to you. Nov 27, 2015 at 18:20 • Then using $_GET (superglobal with all GET parameters, in PHP) fits the "What language features you use to access that input is up to you", right? Nov 27, 2015 at 18:25
• Yes, it does, assuming a GET request becomes an accepted input input. Nov 27, 2015 at 18:37
• Then there is the program <?php eval(key($_GET));. (SQL table input may have similar problems.) Nov 27, 2015 at 18:51 • @jimmy23013 PHP4.1: <?eval($c); (assuming short_tags and register_globals, the code can be anywhere, even in a cookie (if below 4kb)). Or even <?eval(fgets(STDIN)). Or, for Javascript, eval(prompt()). Or eval "$s" for bash. Other languages have the same problem. Any language that allows evaluation of a string containing code has the same problem Nov 27, 2015 at 20:19 • @Dennis Would eval(return {${location.hash}}), assuming your URL is http://example.com/#a:"value",other:"value", fit in this definition? Nov 27, 2015 at 20:32
• @IsmaelMiguel As written, no. Those are neither GET nor POST parameters. Nov 27, 2015 at 20:34
• @Dennis What about eval(location.search.replace(/^\?/,''))? It would create every single variable you would need, right away (if the input is numeric and not an array). The location.search will contain all the GET parameters, optionally starting with an ?. Nov 27, 2015 at 20:38
• This can also be done with php -r '<code>' <A>=<input1> <B>=<input2> (or php-cli, depending on your distribution/installation), which alleviates the need for a web server (a much better option IMO). In this case, scoring is much easier: the -r flag would cost 2 bytes, but the ability to drop the leading <? in the code balances it out. Each GET parameter would cost 1 byte (for the =) plus the length of the parameter name.
– user45941
Nov 28, 2015 at 6:11
• @Mego The -r is free. Read: meta.codegolf.stackexchange.com/q/2424/14732 Nov 28, 2015 at 22:44
• @IsmaelMiguel Fair enough. The rest of my comment still stands.
– user45941
Nov 28, 2015 at 23:42
• @Mego It's still under discussion. Nov 29, 2015 at 1:09
• @IsmaelMiguel Hence why I offered my opinion
– user45941
Nov 29, 2015 at 1:58

# Regexes may output via the list of matched strings (the captured group 0)

• We now have Retina for regex so this can Apr 2, 2016 at 16:13
• @CalculatorFeline Retina is actually Turing Complete. Feb 17, 2017 at 19:14
• ...I'm confused. Feb 20, 2017 at 23:34
• @CalculatorFeline: Retina is more powerful than plain regex is, due to the way it redefined the backquote character (which just matches itself literally in most regex syntaxes). That's enough to make it Turing complete.
– user62131
Apr 27, 2017 at 15:56
• True. But Retina is basically regex+. Do we need this anymore? Apr 28, 2017 at 21:59
• I don't think using plain regex is even allowed, since it isn't Turing complete. Mar 2, 2018 at 2:22

# black-box functions to be taken as input can be passed as an argument

This holds for functional languages or languanges that do have first class functions/anonymous functions/lambda functions or function pointers, for instance: Java, JavaScript, C++, TI-Basic, Python, Octave, Matlab, Haskell, Lisp

• Huh? I'm confused what makes this different from passing inputs as arguments in general. Sep 30, 2018 at 3:24
• @SolomonUcko You mean as opposed to other non-function input types? In that case nothing, but this should just serve as an additional clarification as we introduced black-box functions just last year into our rules. Also consider these two entries: codegolf.meta.stackexchange.com/a/13713/24877 codegolf.meta.stackexchange.com/a/13707/24877 Sep 30, 2018 at 12:07

# An array may be represented in input as a pointer and length.

For example in C you could use:

int f(int*p,int l){...}

• Do you think it should be restricted to C? Jul 12, 2017 at 3:46
• @KeyuGan I think it should be allowed in any language with pointers (c++, asm ...). Do you know of a language where this would be a problem? Jul 12, 2017 at 13:25
• I don't know whether a language exists where both pointer and array are well-defined. Under such circumstances, it may benefit a lot from this rule. I would still suggest languages which does not regard an array of general type as a first-class object may use a reference to first element and length to replace with array/list inputs. Jul 14, 2017 at 9:12
• I'd say this should only be for a language where this is the natural representation of an array Jul 19, 2017 at 20:15
• @keyugan C# supports both standard arrays and C-style pointers Nov 8, 2017 at 23:51
• @Pavel It is the same situation with C++. As for C# (I'm not an expert), many answers are based on LINQ and seemingly they cannot be shortened in this way. Besides, I will say yes to use pointer / length encapsule here. I think it will be better if we could give some restrictions on what language could do so, according to meta discussion, while the original answer doesn't. codegolf.meta.stackexchange.com/questions/13210/… Nov 9, 2017 at 9:17
• @KeyuGan It's just a technicallity really, the only concievable reason to use pointer types in C# is for interop with native code. It probably won't ever apply. Nov 9, 2017 at 15:06
• @KeyuGan Please don't make drastic changes to suggestions.
– user45941
Nov 12, 2017 at 4:56
• How does it affect golfing? It is pretty much the standard way to handle arrays in C. Is the pointer-length pair in the arguments not included in the program length?
– Alex
Jan 20, 2021 at 14:23
• @Alex This establishes that it is an allowable way of taking input in C, or any other pointer based language. Otherwise, it would be nearly impossible for C to take a list as input. Jan 22, 2021 at 1:11

# Programs may take input from a file

• ... only if makes sense for the challenge, and even then you should input a file name first... I'd say Nov 3, 2014 at 6:32
• @JanDvorak That's a "no", because that makes the file name itself the input (which you would take from STDIN or ARGV). Nov 3, 2014 at 11:07

# Functions may return a function that returns the result

This is very similar to currying, the only difference being that only the first call includes an argument. Sometimes it's useful to curry a recursive function that has only one argument, especially if that argument doesn't need to be modified to find the result. For example, each of these JavaScript functions returns the bit-length of a positive integer:

f=(n,x)=>n?f(n>>1,-~x):x
f=(n,x)=>n>>x?f(n,-~x):x
n=>f=x=>n>>x?f(-~x):x


All three functions can be called by assigning them to g and calling them with e.g. g(49); however, the third version must be called again with g(49)() to actually return the result. Again, this is very similar to currying, where the arguments are passed separately (g(a)(b) rather than g(a,b)).

Note that no additional input should be needed to get the result (i.e. "to call on a number x, use f(x)(2)"). Optional arguments are fine, of course (x=>(y=2)=>x+y).

There is also a meta post about this here, though it was closed as a duplicate of this question.

• The only restriction I'd like to see on this is that no additional input should be needed to fetch the result. In other words, the returned function should take no mandatory arguments (optional arguments are fine), so that f(whatever)() would return the result. Otherwise, it falls under additional unspecified input, and therefore violates that loophole.
– user45941
Mar 20, 2017 at 4:12
• @Mego Thanks, I agree. I thought that was implicit, but I've added a mention to the post. Mar 20, 2017 at 16:36
• How many brackets at the last is allowed? 1? or allowed if not that large(only avoid loophole)
– l4m2
Dec 20, 2017 at 2:02
• @l4m2 I'm only vouching for one extra function call here; you could write another answer allowing multiple extraneous calls if you wish. Dec 21, 2017 at 15:31
• @l4m2, I thought about any constant (not related to input) number. May 25, 2019 at 22:21

# black-box functions to be taken as input can be assumed to be predefined under a given name

This holds for languages that do have classical functions, for instance: Java, JavaScript, VB, C, C++, TI-Basic (some versions), Python, Octave, Matlab, Haskell, Lisp

This proposition is the opposite of that one which only allows this method of taking input for languages that cannot take functions as arguments.

• I'm not entirely sure what is meant by this, but if I interpret it correctly, this will have my downvote, as inputs are never assumed to be stored in a variable already, so why are functions any different? Aug 13, 2017 at 22:23
• @Sanchises The problem is a lack of other ways for some languages. E.g. before Java introduced lambdas recently (so everything before Java 8), there was no way for a function to take a "functional" input. Aug 13, 2017 at 22:26
• Maybe add this method as an exception to the other one, so only when your language does not have function pointers or similar? Aug 13, 2017 at 22:31
• @Sanchises I now added a second proposal that includes your suggestion, see linked. Aug 14, 2017 at 21:04

# Programs and functions may return a boolean value via the presence or absence of output

• This is for decision-problem formats, I presume. Aug 12, 2019 at 19:26
• @Giuseppe Yep. Modeled it after the similar one for errors. Aug 12, 2019 at 19:28

# When a challenge asks for an array as input/output, you may use a list instead, and vice-versa

Note that some languages may lack one of these concepts. For example, TI-Basic does not have an array datatype (but has lists) and C does not have a list in its standard library, but has arrays as part of the language.

In keeping with the general flexibility of I/O formats, I suggest we allow to use them interchangeably for all languages.

• A fairly recent meta discussion which basically reached the conclusion that saying "list" in a challenge description is equivalent to any number of possible implementations in different languages which may or may not have different names. To put it a different way, I agree with your intention but I don't think it needs to be specified that "different languages use different words for fundamentally equivalent concepts". Jul 18, 2018 at 16:14

# Functions may return a promise containing the output

## Example

Consider the following function to retrieve my rep from the API, with the output logged from the last Promise in the chain:

f=

_=>fetch("//api.stackexchange.com/users/58974?site=codegolf").then(r=>r.json()).then(j=>console.log(j.items[0].reputation))

f()

I propose instead that we simply be allowed to return the Promise containing the output, like so:

f=

_=>fetch("//api.stackexchange.com/users/58974?site=codegolf").then(r=>r.json()).then(j=>j.items[0].reputation)

f().then(console.log)

## Conditions of Use

This section requires more detail, please edit it to include any other conditions you think should be covered or to add tags to the existing conditions.

### code-golf

In challenges that use code length as a measure for the winning criterion, returning a promise would not be permitted if further manipulation would be required to achieve the desired output, as in this example:

f=

_=>fetch("//api.stackexchange.com/users/58974?site=codegolf").then(r=>r.json()).then(j=>j.items[0])

f().then(i=>console.log(i.reputation))

### fastest-code

If this method is used in time-based challenges then the time required to resolve the final promise must be counted towards your score.

• I feel like we should allow it but add a penality of 5 bytes (.then) due to the overhead in calling like using a command line flag. May 12, 2017 at 6:34
• @Christoph, I can see your point. I suggest posting that as a counter-proposal as simply editing in as an option above won't tell us what the consensus is. May 12, 2017 at 7:11
• I'd allow this except in fastest-code and similar time-based challenges (or at least count the time taken in forcing the promise, in that case), for what I hope are obvious reasons.
– user62131
May 17, 2017 at 7:23
• @ais523, I've added a section on conditions of use, feel free to edit it to add more detail, tags and/or examples. May 23, 2017 at 10:28
• This should be updated for await / async - especially as Chrome console has top-level await. The "get the answer" part of the [code-golf] snippet can be shortened to (await f()).reputation. Jan 11, 2018 at 8:11

# Metaprogramming languages may return a boolean by compiling/not compiling

For example, C++ template metaprogramming has no "return value". A common way for a C++ template metaprogramming to reject something is to fail to compile (sometimes in a SFINAE way, sometimes not).

• if C++ doesn't compile, it prints to STDERR? If so, this could be generalized to allow boolean output by STDOUT vs STDERR. Nov 13, 2018 at 2:28
• @NathanMerrill If something does not compile, it doesn't output at all, I think. Expect compiling/not compiling (as described here). Jul 17, 2019 at 13:57

# Lists of decimal digits and strings that match ^[0-9]*$ are interchangeable... ...but not when this may make the input format inconsistent. For example, let's say you can assume the string input will match ^[1457]+$, which is a subset of ^[0-9]*$. Then, '1775' can also be input as [1, 7, 7, 5]. However, for a counterexample, let's assume the string input will match ^[a0-8]{2,15}$, which isn't a subset of ^[0-9]*$. In this case, no, you may not use a list of digits, since you can't use one to represent 1aa7708, for example. You can use [1, 1, 8, 8, 6, 4] to represent 118864, but this inconsistency is invalid by default. I posted this after having come across numerous occurrences where I've had to ask about this in the comment section of the question, so I thought "why not post this here?". Surprisingly, this, AFAICT, hasn't ever been posted yet! I definitely have a positive opinion. # Programs may write output to the clipboard Complementing the programs may take input from the clipboard proposal. • I agree with this, this is just like the proposal where stack-based languages could write to the stack instead of outputting the result Feb 28, 2017 at 10:05 • This would mean that any program can compute the identity by doing nothing, right? That's kind-of weird. – xnor Feb 28, 2017 at 21:17 • While I agree that that is weird, I don't think that that is grounds to down vote. That is abusable in exactly 1 challenge, (and that loophole could be closed in that 1 challenge) Mar 6, 2017 at 14:14 • If you favor this proposal, you should also allow the identity to be computed by outputting on stdin. Mar 30, 2017 at 2:27 # Programs may output using their return value Iff it is legit regarding their specs and compilers. Certain language treat programs as function, allowing programs to communicate via returns. Hence, we shoule allow such programs to be considered as whole, and not as snippet. • This has my upvote, because it is natural to languages as lua, where we often use this mechanism when creating an object. Aug 9, 2016 at 21:46 • Is this different from meta.codegolf.stackexchange.com/a/5330/8478? Aug 9, 2016 at 22:30 • @MartinEnder: This refers to codegolf.stackexchange.com/a/88856/15 this answer here and explicitly concerns itself with return values of programs that are not integers. Which, incidentally, doesn't work in any environment I know of. – Joey Aug 10, 2016 at 7:00 • Ok, basically you are referring to the fact that you can embed Lua and have the host application handle any return values from the "main" Lua program in a suitable manner. It's just that the default Lua interpreter will effectively do nothing with the stack contents in that case, right? – Joey Aug 10, 2016 at 17:57 • @MartinEnder I think it is a generalisation of the one you're pointing to. I'm only creating this post as some PPCGer think it doesn't apply to returns, and I'd like to have a clear consensus on the return for programs, instead of one that simply embed it because of its definition. Aug 11, 2016 at 7:35 • @joey in lua, you can see this value the same way you would do for a library. As this is generally some short piece of code, you could use both local answer = require"codegolf" and local answer = loadstring("program copypasted")() Aug 11, 2016 at 7:39 # Regexes may output via any captured groups Users can specify which subset of captured group(s) contains the output; it doesn't have to be just group 0. • perhaps reword to "a specified subset of captured groups" any could be mis-interpreted as allowing a different subset at each call. Dec 22, 2016 at 10:51 • Is this to be interpreted such that the specification of which backref(s) contain the output is not counted towards the byte length of the regex program? I would strongly disagree with that, since the backref numbers are an integral part of the program and without them, it would not do anything useful. Is there any other language with a rule like this? At best, any regex answer that uses this rule should be treated as a distinct language which varies depending on the exact combination of backref numbers, like command-line parameters. Feb 26, 2019 at 19:29 • @Deadcode yes, there are other languages with rules like this: asm may output via registers, and specifying the register numbers doesn't add to your byte count. Feb 28, 2019 at 9:03 • Should non-participating capture groups count as empty string / 0 for the purpose of this rule? Feb 28, 2019 at 9:23 • Also, for unary regexes, can the meaning of the capture groups be specified to include combinations of groups to make output of larger numbers possible, for example \4*\2^2 + \5*\2 + \6 or examples such as those shown here? Without this, it is only possible to output numbers less than or equal to the input (or the largest input number, in the case of multiple delimited input numbers). Feb 28, 2019 at 22:41 # Programs may take input as arguments to command line flags If a language has a command line flag in the form --flag=arg, input may be taken as the argument to that flag. For example: ./language -f --option=2 <prog>  Can be run for the input 2. # For languages not containing a formal implementation of an input or output data type, the data type may be implemented as standardized for the language For instance, in TIS-100, all inputs and outputs are integers ranging from -999 to 999. Therefore, arrays of positive integers are often terminated with zeroes. If a challenge asks to take in the array [3, 4, 5, 6] and return [6, 8, 10, 12], in TIS-100 the implementation would be to take in the sequence 3 4 5 6 0 and output the sequence 6 8 10 12 0. • I don't think "as standardized for the language" is very well-defined. Apr 7 at 10:16 # An array may be represented in input as a begin pointer and an end pointer. like what's done in C++ std • So you mean the iterator model that the C++ STL uses? I like this. – user45941 Mar 7, 2018 at 3:46 • "like what's done in C++ std" - that needs to be fleshed out a bit more, maybe with an example, for those unfamiliar with C(++). Mar 8, 2018 at 8:15 • @Shaggy What other language have pointer but not enough knower know C/C++? – l4m2 Mar 8, 2018 at 12:02 • @l4m2 Well, C and C#. Both of them have pointers and both of them have lots of users that don't know how the C++ standard library works. Mar 12, 2018 at 15:17 # Regexes may output a number via the number of matches Or truthy / falsey as whether they match. • Plain regex submissions are still not generally accepted as valid so I'm not sure it's worth adding defaults for this very specific case that a lot of people don't accept at all. May 30, 2015 at 10:27 • Again , Retina. Apr 2, 2016 at 16:14 # Programs may take input from the clipboard • why would anyone downvote this? i see literally no reason this shouldnt be allowed, its just another place to grab input from :P Jun 23 at 19:47 # A multidimensional rectangular array may be represented by the list [dimensions, flattened array] # Numerical input and output can be given as a character code For example, the input 64 can instead be given as the character @. This is mainly used for more esoteric languages that can only take input through character codes, for example brainfuck. • Note that this was already a consensus here, I'm just adding it here to make it easier to find. – Jo King Mod Aug 28, 2019 at 12:47 # Floating point numbers may be represented as fractions. For example, instead of literal 0.5 or "0.5", the program can return "1/2" or [1,2]. It's especially useful for languages without out-of-the-box floating point support. • But does the fraction have to be reduced? – Adám Jun 10, 2020 at 15:16 • I leave it up as a consensus. Reducing a fraction isn't a very complex task, but if it is necessary (due to some loophole I can't find currently) then reducing the fraction might be necessary. Jun 10, 2020 at 16:56 # BASIC and related languages may take input via DATA / READ In various dialects of BASIC, you can include data in the source code by using the DATA statement: DATA abc, xyz DATA 2, 3, 5, 7, 11  (Examples are written in QBasic because that's what I know.) You access this data by using READ: READ str1$, str2\$
FOR i = 1 TO 5
NEXT


This input method is idiomatic for BASIC.

• Is this basically the equivalent of final static in Java? Mar 5, 2017 at 5:03
• @NathanMerrill I don't think it's similar at all, actually. Based on 2 mins of research on Java, it looks like final is equivalent to CONST in QBasic, and static doesn't have an equivalent because QBasic doesn't have classes. READ is like INPUT, except the input is stored in the program with DATA so the user doesn't have to retype it each time they run the code. Mar 5, 2017 at 5:42
• I guess I don't follow: when would you use const vs data/read? It seems like reading data already stored in your program is a waste of CPU cycles. Mar 5, 2017 at 14:32
• @NathanMerrill Initializing arrays is one use case, since as far as I know BASIC doesn't have anything like C's int array[3] = {2,3,5};. In QBasic you DIM array(3) and then you can either do array(1)=2: array(2)=3: array(3)=5 (etc.) or you can write an easy-to-read FOR loop as above and put DATA 2, 3, 5 in the program. For large amounts of data (like layouts for a maze game), it might be better programming practice to put the data into a different file, but in the interests of being self-contained and not having to deal with file I/O, the DATA statement is often used instead. Mar 6, 2017 at 7:09
• Note also that READ does not result in fixed values like CONST does. If you do CONST pi = 3.14, you can never modify that value (assigning to pi thereafter is a syntax error). But you can READ x and then do x=x+1 (or whatever). And you can READ multiple different data values into the same variable (in a loop, say). Mar 6, 2017 at 7:16
• The argument is that the Data command effectively creates unnamed constant variables (and read just reads them), so the fact that you can modify the read ones is irrelevant IMO. I'm on the fence here: the syntax is similar to input from the user, but it also feels like reading from a variable. Mar 6, 2017 at 14:08
• The ZX80 and ZX80 do not have DATA/READ keywords in its default interpreter. One has to store data in variables, or in REM statements and - in this case - read each byte by using the PEEK keyword. Apr 4, 2017 at 9:03
• Would the very similar <DATA> be accepted in Perl? (docs: perldoc.perl.org/SelfLoader.html#The-DATA-token). May 31, 2017 at 15:21
• @DLosc - is there a consensus as to what portions of the Read and Data statements are to be included in the bytecount? Is this Yabasic snippet scored correctly? Apr 8 at 4:58
• @TaylorRaine That's a good question. I don't think there is a consensus. My initial reaction is that DATA should be included in the bytecount--only the data itself should not be. But that still raises questions about the comma in DATA 2,3... Apr 8 at 15:43
• Apr 8 at 16:58

# SQL-based languages can output via SELECT or PRINT

We have countless examples of highly upvoted answers sending SQL output to either the results pane (via SELECT) or to the messages pane (via PRINT), depending on which works the best and is shorter for a particular challenge.

Both are acceptable.

(This uses terminology from MS SQL Management Studio, other platforms/clients likely have equivalents.)

Other outputs may be possible as well, such as outputting graphical results to the spatial results pane.