1
Introduction
A quine is a program that takes no input and produces a copy of its own source code as output. Writing a quine is a standard test of a programming language. Most quines operate using strings of characters: that is what the source code is made of, after all! However, this quine is slightly different.
Challenge
Your challenge is to write a program that takes no input and produces the number of bytes in the program as output.
- By "takes no input", I mean does not change based on input. Your program can still take command line arguments, or even arguments from stdin, but it cannot do anything with them. It must either discard or ignore them. Basically, your program should produce the same output no matter what input is given.
- Your program must output the number of bytes in it. If it is a function, it can output through its return value. If, and only if your language has no stdout, you may store output in a variable. The input can be printed as a string or an integer; the user cannot tell the difference between the output of
print('5')
orprint(5)
! Note that I said byte count, not character count. If your program uses Unicode characters that take up more than 1 byte (like some Jelly or APL programs), the output must reflect that.
Rules
This is code-golf so shortest answer in bytes wins! Edit: Actually, since there is a 1 byte answer, let's do top 3 shortest.
Edit: this question is not the same as Output your Score. For one, this one does not disallow cheating quines. Also, I do not require a trailing " bytes" in output.
Does this have to meet standard Quine rules? For instance,
1
in Jelly is 1 byte long, and would output 1, is that acceptable? – caird coinheringaahing – 2019-11-02T00:24:29.443@caird coinheringaahing - you do not have to follow standard rules. In this challenge, if it doesn't say you can't, assume you can. – sugarfi – 2019-11-02T01:11:05.017
When you say "byte count", do you mean UTF-8 byte count, or can we use our own encodings? For instance, if
¬
outputs 1, and is encoded as a single byte in our code page, would that be an acceptable answer? – caird coinheringaahing – 2019-11-02T01:14:32.990No. A said in the answer, Unicode/UTF-8 byte counts are used. – sugarfi – 2019-11-02T01:30:02.253
3
Possible duplicate of Output your score
– Jo King – 2019-11-02T04:07:13.3372Characters in languages with SBCS do take up only one byte, so I don't see the point of penalising them for what character they use (which seems to be the opposite of what you want) – Jo King – 2019-11-02T04:10:20.880
2@JoKing pppery I would say this challenge is sufficiently different, given that the other is restricted-source. – Stephen – 2019-11-02T18:52:40.067
My biggest problem with calling this a duplicate is that my answer here meets this challenge. No way it meets the other challenge. It's not even possible. The same might be true for many, if not most, of the other answers here. That doesn't feel right somehow.... – ouflak – 2019-11-04T11:22:44.673