112
\$\begingroup\$

In this challenge, you should write a program or function which takes no input and prints or returns a string with the same number of bytes as the program itself. There are a few rules:

  • You may only output bytes in the printable ASCII range (0x20 to 0x7E, inclusive), or newlines (0x0A or 0x0D).
  • Your code must not be a quine, so the code and the output must differ in at least one byte.
  • Your code must be at least one byte long.
  • If your output contains trailing newlines, those are part of the byte count.
  • If your code requires non-standard command-line flags, count them as usual (i.e. by adding the difference to a standard invocation of your language's implementation to the byte count), and the output's length must match your solution's score. E.g. if your program is ab and requires the non-standard flag -n (we'll assume it can't be combined with standard flags, so it's 3 bytes), you should output 5 bytes in total.
  • The output doesn't always have to be the same, as long as you can show that every possible output satisfies the above requirements.
  • Usual quine rules don't apply. You may read the source code or its size, but I doubt this will be shorter than hardcoding it in most languages.

You may write a program or a function and use any of the standard methods of providing output. Note that if you print the result, you may choose to print it either to the standard output or the standard error stream, but only one of them counts.

You may use any programming language, but note that these loopholes are forbidden by default.

This is , so the shortest valid answer – measured in bytes – wins.

Leaderboard

var QUESTION_ID=121056,OVERRIDE_USER=8478;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){var F=function(a){return a.lang.replace(/<\/?a.*?>/g,"").toLowerCase()},el=F(e),sl=F(s);return el>sl?1:el<sl?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table>

\$\endgroup\$
22
  • 2
    \$\begingroup\$ Related. Related. \$\endgroup\$ Commented May 17, 2017 at 11:19
  • 22
    \$\begingroup\$ "Your code must not be a quine" but... but... it's tagged quine \$\endgroup\$
    – Okx
    Commented May 17, 2017 at 11:21
  • 4
    \$\begingroup\$ @Okx Because it's a generalised quine, i.e. the required output depends on the source code. \$\endgroup\$ Commented May 17, 2017 at 11:22
  • 4
    \$\begingroup\$ @MartinEnder You should probably disallow output by exit code, which is a default. If you allow it nearly every one byte program in nearly every language is allowed. One user has already done this \$\endgroup\$
    – Wheat Wizard
    Commented May 17, 2017 at 22:37
  • 2
    \$\begingroup\$ @WheatWizard output by exit code is not a string, so it doesn't apply here. \$\endgroup\$ Commented May 18, 2017 at 4:29

288 Answers 288

1
2
3 4 5
10
7
\$\begingroup\$

Jelly, 1 byte

V

Quite a few Jelly one byters - this is one - it evaluates the left argument which, when nothing is provided as input, defaults to zero which in turn evaluates to zero and the result is implicitly printed, a 0.

Try it online!

In fact, of the 256 bytes in the code-page there are only 95 that do not currently produce a different one byte output within the specified range when run as a full program; these are (as code-page characters in byte order):

¡¢£¦©½¿€ÇÑÞßçıȷñ÷þ"#&',-./0123456789:;?@IMRTVZ\`dmpstxyz{}~°³⁴⁵⁹ƓƈɠḶỌṬḊĖİĿṄȮṖṘẆẊṃọṣṭḃḟḣŀṁṗṡẋż’“

Notes:

  • Most of the 1-byte programs print a 0 (no-ops / yielding a list with a single zero in, which prints a 0), most others print a 1 (0=0 and the like)

  • is the one program which does yield a different byte, but one which is out of range as per the specification - it produces the null-byte (casts the 0 to character)

  • produces a space (a literal)

  • produces a line feed (a literal)

  • Some bytes that do work now may not do so in the future - there are a fair few bytes being reserved (I believe) for niladic values which, when assigned, are almost certainly not going to produce one-byte output.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Dead link for byte \$\endgroup\$
    – Weedoze
    Commented May 17, 2017 at 11:35
7
\$\begingroup\$

Ruby, 5 4 3 bytes

Crossed out 4 is still 4 ;(

p$*

Prints [] (empty array) then a newline

Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ Nice. I was about to propose p p, but didn't think about the newline. \$\endgroup\$ Commented May 20, 2017 at 9:16
7
\$\begingroup\$

APL, 2 bytes

-1

Prints ¯1 (the - is the Minus monad, whereas ¯ is the High minus negative indicator).

\$\endgroup\$
7
\$\begingroup\$

C#, 22 16 bytes

()=>$"{1L<<50}";

-6 bytes thanks to Orjan Johansen, using long instead of int.

Outputs

1125899906842624

Alternately, if you allow an arbitrary parameter to be passed into the lambda:

C#, 21 15 bytes

_=>$"{1L<<49}";

Outputs

562949953421312
\$\endgroup\$
4
  • \$\begingroup\$ If you use long you can do it shorter with only one group: ()=>$"{1L<<50}";. Try it online! \$\endgroup\$ Commented May 17, 2017 at 23:49
  • \$\begingroup\$ Good job on posting such a short C# answer. You can also shave of a byte by using +"" instead of string interpolation. \$\endgroup\$
    – LiefdeWen
    Commented May 18, 2017 at 8:16
  • \$\begingroup\$ Neither 1L<<50+"" or ""+1L<<50 works for me due to << having lower precedence than +, so would need to add parens making the length the same. \$\endgroup\$
    – milk
    Commented May 18, 2017 at 19:37
  • 2
    \$\begingroup\$ Why do you include a semicolon? It's not part of the function. \$\endgroup\$ Commented May 21, 2017 at 15:08
7
\$\begingroup\$

Cubix, 6 4 bytes

@"Ou

Try it online

Cubified

  @
" O u .
  .

This pushes the string Ou. to the stack, Outputs the top character (.) as a character code (46), does a u-turn to the right, Outputs again, and exits with @.

\$\endgroup\$
1
  • \$\begingroup\$ very nice answer, @(Ou works as well \$\endgroup\$
    – MickyT
    Commented May 18, 2017 at 19:01
7
\$\begingroup\$

Excel, 7 bytes

=9^7&""

Produces a 7 digit number and then appends empty string

Uses general idea from pajonk in their answer [although obviously not the language trick :)]

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Welcome to PPCG! I edited your header so that it gets picked up by the leaderboard. :) \$\endgroup\$ Commented May 19, 2017 at 13:52
  • \$\begingroup\$ "Why not just make a 4 digit number?" The challenge states that the function must return a string. It can be checked by T function whether something is string in Excel - the first solution isn't, the second is. Anyway, upvote as promised. \$\endgroup\$
    – pajonk
    Commented May 20, 2017 at 16:51
  • \$\begingroup\$ @pajonk Great point. I have taken the smaller solution out as I agree it does not meet the conditions. Thanks! \$\endgroup\$
    – OpiesDad
    Commented May 20, 2017 at 21:19
7
\$\begingroup\$

NodeJS REPL, 4 bytes

Did someone say REPLs are languages?

*;;;

..._

(the underscore is actually a space character).

For anyone not familiar with the Node REPL, it thinks my program isn't complete, so it's prompting for the rest of the line.

\$\endgroup\$
1
  • \$\begingroup\$ You could also use !!!0, 1e2 or "" \$\endgroup\$
    – powelles
    Commented May 22, 2017 at 19:48
6
\$\begingroup\$

JavaScript (ES6), 9 bytes

_=>""+1E8

Returns 1 * 10^8, or 100000000.

If I can return a number instead of a string, _=>1E5 is 6 bytes.

f=
_=>""+1E8

console.log(f())

\$\endgroup\$
5
  • 1
    \$\begingroup\$ Beat me by a couple of minutes. \$\endgroup\$ Commented May 17, 2017 at 11:32
  • 1
    \$\begingroup\$ Some of the Python answers seem to be outputting numbers, so you should be fine doing the same. \$\endgroup\$ Commented May 17, 2017 at 11:53
  • 1
    \$\begingroup\$ @numbermaniac But they print them, which converts them to string. \$\endgroup\$
    – Neil
    Commented May 17, 2017 at 11:57
  • \$\begingroup\$ @numbermaniac OP (Martin Ender) told me it was wrong. \$\endgroup\$
    – Stephen
    Commented May 17, 2017 at 12:29
  • \$\begingroup\$ a=b=>b+"" 9 bytes Include the function name :) \$\endgroup\$ Commented Oct 1, 2019 at 6:54
6
\$\begingroup\$

QBasic 4.5, 1 byte

?

This prints nothing. Followed by a newline.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Thou winneth one internet. \$\endgroup\$
    – Joshua
    Commented May 20, 2017 at 19:24
6
\$\begingroup\$

bash, 48 bytes

bash bash bash bash bash bash! bash! bash! bash!

Output:

/bin/bash: /bin/bash: cannot execute binary file
\$\endgroup\$
1
  • \$\begingroup\$ −1: I downvoted this answer because there are substantially shorter options, for starters e. g. 17 Bytes echo $((10**15)). \$\endgroup\$ Commented Mar 9 at 13:49
6
\$\begingroup\$

R, 3 2 bytes

-T

Outputs:

-1

Old 3 byte answers:

Many examples, such as:

1/0
F/F
3^6

Outputs respectively:

Inf
NaN
729

Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ hah, -T! clever! \$\endgroup\$
    – Giuseppe
    Commented Aug 14, 2018 at 17:28
5
\$\begingroup\$

JavaScript (ES6), 17 11 bytes

f=_=>"g="+f

Try it

f=_=>"g="+f
console.log("Function source: f="+f)
console.log("Function length: "+(""+f).length+" + 2 (for variable assignment) = "+((""+f).length+2))
console.log("Function output: "+f())
console.log("Output length: "+f().length)
console.log("Output type: "+typeof f())

\$\endgroup\$
0
5
\$\begingroup\$

><>, 4 bytes

"on;

Try it online!

Outputs ;110

\$\endgroup\$
5
\$\begingroup\$

Python 2, 10 bytes

Try it online

print 9**9

Outputs 10 bytes:

387420489
*newline*

There are other 10-byte answers with decimals and power. I like this one for e in the output:

print.3**8

Output:

6.561e-05
*newline*

Same 10 bytes, but for division (there are 5 versions):

.1/64 = 0.0015625
.3/64 = 0.0046875
.5/64 = 0.0078125
.7/64 = 0.0109375
.9/64 = 0.0140625


print.1/64

outputs:

0.0015625
*newline*
\$\endgroup\$
2
  • 1
    \$\begingroup\$ Also works in Cheddar \$\endgroup\$
    – Leaky Nun
    Commented May 17, 2017 at 11:44
  • 2
    \$\begingroup\$ @LeakyNun Why don't you post it as answer? \$\endgroup\$ Commented May 17, 2017 at 11:46
5
\$\begingroup\$

Python 3, 53 bytes

s='s=%r;print("0"*~-len(s%%s))';print("0"*~-len(s%s))

Try it online!

This must be the most quine-like answer ever.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Why not print(1e6)? \$\endgroup\$ Commented May 17, 2017 at 19:05
  • \$\begingroup\$ @CalculatorFeline that would be un-quine-like. \$\endgroup\$
    – Leaky Nun
    Commented May 18, 2017 at 3:50
  • \$\begingroup\$ Your answer should not be a quine. \$\endgroup\$
    – Notts90
    Commented May 18, 2017 at 9:12
  • \$\begingroup\$ @Notts90 this isn't a quine. \$\endgroup\$
    – Leaky Nun
    Commented May 18, 2017 at 9:13
5
\$\begingroup\$

dc, 2 bytes

Kp

Try it online!

Pushes the current precision on the stack (which is 0) and prints it with a trailing newline.

\$\endgroup\$
1
  • \$\begingroup\$ dc prints a trailing newline after any command. The command 'c' has no other output, so it works and is one byte shorter \$\endgroup\$
    – Jared K
    Commented Mar 30, 2018 at 19:22
5
\$\begingroup\$

Fourier, 1 byte

o

Try it FourIDE!

Note, TIO.run outputs a trailing newline

Outputs the value of the accumulator, 0.

More interesting programs:

2P15o

Try it on FourIDE!

Outputs 215, 32768.


4^do

Try it on FourIDE!

Outputs the current year (doesn't work if used before 1000 AD).


999**999o

Try it on FourIDE!

Outputs 997002999. The ** is undefined behaviour in Fourier. The way I think it works is A**B = A*A*B.

\$\endgroup\$
0
5
\$\begingroup\$

Alice, 5 bytes

g/@O

Try it online!

Prints:

103
g

Explanation

This was quite fun to figure out. :)

g   Pop two implicit zeros from the stack and retrieve the code point at that
    location in the code. That's the 'g' itself, so we're pushing 103.
/   Reflect to SE. Switch to Ordinal. The IP bounces diagonally up and down
    through the code.
O   Implicitly convert the 103 to "103" and print it with a trailing linefeed.
    Bounce off the top right corner and move back.
/   Reflect to W/ Switch to Cardinal.
g   Push 103 again.
    The IP wraps back to the last column
O   Interpret the 103 as a code point and print the corresponding character.
    This prints 'g'.   
@   Terminate the program.
\$\endgroup\$
5
\$\begingroup\$

AWK, 21 bytes

BEGIN{printf"%21s",0}

Try it online!

Simply prints:

                    0

The 0 could of course be any digit. No new line is printed, since that would add 2 bytes.

\$\endgroup\$
5
\$\begingroup\$

Underload, 6 bytes

()aaaS

Try it online!

Prints ((())).

() pushes an empty string to the stack. a "stringifies" it by wrapping it in (...) so after aaa we get (((()))). S prints that string (without the outermost parentheses, so we get only three pairs).

\$\endgroup\$
5
\$\begingroup\$

Perl 5, 9 bytes

print$"x9

Prints 9 spaces, no newline.

Explanation

$" contains a " " by default. x9 uses the repetition operator to "multiply" the string by 9.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Welcome to PPCG! \$\endgroup\$ Commented May 18, 2017 at 13:24
5
\$\begingroup\$

Powershell, 38 bytes

Just for fun, an answer that returns different output each time it's called.

[System.Guid]::NewGuid().ToString("B")

Prints a GUID surrounded with braces ("B"), such as:

{24cc14a3-ada4-4fcd-8a08-ec419b00f22d}
\$\endgroup\$
5
\$\begingroup\$

C (modern Linux), 19 bytes

main(){raise(11);}

Output (with newline):

Segmentation fault 

How it works:

SIGSEGV is defined as 11 in /usr/include/asm-generic/signal.h. Therefore, raise(11) raises SIGSEGV, and when SIGSEGV is raised on Linux, all execution stops and Segmentation fault is printed.

20 bytes

main(){raise(2*2);}

Output (with newline):

Illegal instruction 

22 bytes

main(){raise(2*3-1);}

Output (with newline):

Trace/breakpoint trap

22 bytes

main(){raise(5*2+5);} 

Output (with newline):

User defined signal 1 

22 bytes

main(){raise(1?26:0);}

Output (with newline):

Virtual timer expired 

24 bytes

main(){raise(12*(1+1));}

Output (with newline):

CPU time limit exceeded 

25 bytes

main(){raise(5*5?5*5:0);}

Output (with newline):

File size limit exceeded 

25 bytes

main(){printf(raise(8));}

Output (with newline):

Floating point exception 
\$\endgroup\$
10
  • 1
    \$\begingroup\$ isn't that first one 18 bytes? \$\endgroup\$ Commented May 23, 2017 at 4:28
  • \$\begingroup\$ @DestructibleLemon Nope. There's a newline at the end. \$\endgroup\$
    – MD XF
    Commented May 23, 2017 at 4:29
  • 1
    \$\begingroup\$ why isn't the second one 20 bytes then? \$\endgroup\$ Commented May 23, 2017 at 4:53
  • 2
    \$\begingroup\$ To be pedantic, all of these messages are written by the shell that launched your program, not by your program itself. \$\endgroup\$ Commented May 25, 2017 at 8:16
  • 2
    \$\begingroup\$ @MDXF It really is the shell, not the kernel. You can prove it by running echo 'main(){raise(11);}' | gcc -xc -; echo ./a.out | strace bash, which shows bash making the write call. The exact format varies from shell to shell. Here is where the message is defined within the bash source code. You will not find it anywhere in the Linux kernel outside of documentation. \$\endgroup\$ Commented May 25, 2017 at 20:54
5
\$\begingroup\$

Pyramid Scheme, 32 bytes

^ ^ 
-^-
^-^
-^-
^-^
-^-
^-^
- -

Try it online!

Explanation

This may not look like pyramid scheme but it is. Each triangle looks like:

 ^
 -

This performs one of three operations

  • If it has 2 args it pairs them together

  • If it has 1 arg it returns it

  • If it has 0 args it returns 0

So at the bottom we have two zeros, those are linked on the next level. On the next level two different pyramids grab the pair and then those pairs are paired together. This continues all the way up the pyramid. When we get to the top we have:

 ((((0,0),(0,0)),((0,0),(0,0))),(((0,0),(0,0)),((0,0),(0,0))))

Pyramid scheme's implicit output converts this to 16 zeros separated by newlines. That's 32 bytes.

\$\endgroup\$
4
\$\begingroup\$

Java, 82 bytes

interface M{static void main(String[]a){for(int i=0;i++<82;)System.out.print(1);}}

Output:

1111111111111111111111111111111111111111111111111111111111111111111111111111111111

Try it online!

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Why not a lambda? I admit that it is boring, but I think it could be included to showcase Java 8. \$\endgroup\$
    – Yytsi
    Commented May 17, 2017 at 12:10
  • 1
    \$\begingroup\$ @TuukkaX I made one! \$\endgroup\$ Commented May 19, 2017 at 7:30
4
\$\begingroup\$

Bash, 1 byte:

#

It sort of outputs a newline...although I don't know if the program gets credit for that or the Bash interpreter.

I'm a bit dubious that this counts, so:

Bash, 21 bytes

x=12345;echo $x$x$x$x

This is really terrible, I know. Are you allowed to call any standard program with Bash?

\$\endgroup\$
8
  • 2
    \$\begingroup\$ codegolf.meta.stackexchange.com/a/7833/56341 languages are denfined by their implementation rather than by their declaration. so your 1 byte solution is perfectly valid \$\endgroup\$ Commented May 17, 2017 at 11:53
  • 1
    \$\begingroup\$ Ok. I'm still not sure. Calling almost anything from a bash shell will generate a new line, it's not even the interpreter that's looking at my program that does that (I think). It's just that after doing whatever my program does (which is nothing), the Bash shell (which is essentially a REPL) outputs a blank line. \$\endgroup\$ Commented May 17, 2017 at 11:59
  • 5
    \$\begingroup\$ It doesn't output anything. What version of Bash are you using? \$\endgroup\$
    – eush77
    Commented May 17, 2017 at 12:44
  • 1
    \$\begingroup\$ x=12345;echo $x$x$x$x only outputs 20 characters for a 21 character input. Try x=1234567;echo $x$x$x also 21 characters, 21 characters output (123456712345671234567) - oh wait, do we count the implicit \n? does that count as a feature of the program or the shell displaying output? \$\endgroup\$
    – Baldrickk
    Commented May 17, 2017 at 13:21
  • 1
    \$\begingroup\$ Run that piped to wc -c and you find it doesn't output anything at all. \$\endgroup\$
    – Joshua
    Commented May 20, 2017 at 19:22
4
\$\begingroup\$

GNU Make, 24 21 bytes

$(sort $(value $(0)))

returns

$(0))) $(sort $(value

Complete makefile:

X=$(sort $(value $(0)))
$(info $(call X))
\$\endgroup\$
3
  • \$\begingroup\$ How do you invoke this? For me if I put this in a Makefile and run make, I get make: *** No targets. Stop. \$\endgroup\$ Commented May 17, 2017 at 15:56
  • \$\begingroup\$ @DigitalTrauma It's a user-defined function. I added the boilerplate to the post. \$\endgroup\$
    – eush77
    Commented May 17, 2017 at 16:10
  • \$\begingroup\$ Very impressive! +1 \$\endgroup\$
    – MD XF
    Commented May 19, 2017 at 1:38
4
\$\begingroup\$

Pyth, 1 byte

k

It prints a new line character.

Explanation: k is just a variable initialized to '' (empty string), and by default Pyth prints the values of instructions which do nothing, followed by a new line character. In this case, it prints an empty string and then the new line character.

Test it online! (the online interpreter doesn't show the \n, you will have to install Pyth on your computer to actually see it)

\$\endgroup\$
0
4
\$\begingroup\$

Taxi, 540 bytes.

62 is waiting at Starchild Numerology.Go to Starchild Numerology:w 1 l 2 r 1 l 1 l 2 l.Pickup a passenger going to The Underground.Go to The Underground:w 1 r 2 r 1 r 2 l.[r]Switch to plan "e" if no one is waiting.Pickup a passenger going to Cyclone.Go to Cyclone:n 3 l 2 l.Pickup a passenger going to The Babelfishery.Pickup a passenger going to The Underground.Go to The Babelfishery:s 1 l 2 r 1 r.Pickup a passenger going to Post Office.Go to Post Office:n 1 l 1 r.Go to Fueler Up:n 1 r 1 l.Go to The Underground:n.Switch to plan "r".[e]

Try it online!

Ungolfed:

62 is waiting at Starchild Numerology.
Go to Starchild Numerology: west 1st left 2nd right 1st left 1st left 2nd left.
Pickup a passenger going to The Underground.
Go to The Underground: west 1st right 2nd right 1st right 2nd left.
[r]
Switch to plan "e" if no one is waiting.
Pickup a passenger going to Cyclone.
Go to Cyclone: north 3rd left 2nd left.
Pickup a passenger going to The Babelfishery.
Pickup a passenger going to The Underground.
Go to The Babelfishery: south 1st left 2nd right 1st right.
Pickup a passenger going to Post Office.
Go to Post Office: north 1st left 1st right.
Go to Fueler Up: north 1st right 1st left.
Go to The Underground: north.
Switch to plan "r".
[e]

It prints the integers 61 through 1 in descending order and with a decimal and 6 trailing zeros:

61.00000060.00000059.00000058.00000057.00000056.00000055.00000054.00000053.00000052.00000051.00000050.00000049.00000048.00000047.00000046.00000045.00000044.00000043.00000042.00000041.00000040.00000039.00000038.00000037.00000036.00000035.00000034.00000033.00000032.00000031.00000030.00000029.00000028.00000027.00000026.00000025.00000024.00000023.00000022.00000021.00000020.00000019.00000018.00000017.00000016.00000015.00000014.00000013.00000012.00000011.00000010.0000009.0000008.0000007.0000006.0000005.0000004.0000003.0000002.0000001.000000
\$\endgroup\$
4
\$\begingroup\$

PowerShell, 2 bytes

+1

The upvote program. This give the output of 1 and a trailing newline to get 2 bytes. I am unsure if the operation is adding 1 to nothing or if it is rendering the positive integer of 1. Either way the result is the same.

\$\endgroup\$
1
2
3 4 5
10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.