# Golf you a quine for great good!

Using your language of choice, golf a quine.

A quine is a non-empty computer program which takes no input and produces a copy of its own source code as its only output.

No cheating -- that means that you can't just read the source file and print it. Also, in many languages, an empty file is also a quine: that isn't considered a legit quine either.

No error quines -- there is already a separate challenge for error quines.

Points for:

• Smallest code (in bytes)
• Most obfuscated/obscure solution
• Using esoteric/obscure languages
• Successfully using languages that are difficult to golf in

The following Stack Snippet can be used to get a quick view of the current score in each language, and thus to know which languages have existing answers and what sort of target you have to beat:

var QUESTION_ID=69;
var OVERRIDE_USER=98;

getAnswers();var SCORE_REG=(function(){var headerTag=String.raw h\d
var score=String.raw \-?\d+\.?\d*
var normalText=String.raw [^\n<>]*
var strikethrough=String.raw <s>${normalText}</s>|<strike>${normalText}</strike>|<del>${normalText}</del> var noDigitText=String.raw [^\n\d<>]* var htmlTag=String.raw <[^\n<>]+> return new RegExp(String.raw <${headerTag}>+String.raw \s*([^\n,]*[^\s,]),.*?+String.raw (${score})+String.raw (?=+String.raw ${noDigitText}+String.raw (?:(?:${strikethrough}|${htmlTag})${noDigitText})*+String.raw </${headerTag}>+String.raw ))})();var OVERRIDE_REG=/^Override\s*header:\s*/i;function getAuthorName(a){return a.owner.display_name}
body='<h1>'+c.body.replace(OVERRIDE_REG,'')+'</h1>'});var match=body.match(SCORE_REG);if(match)
if(languages.hasOwnProperty(lang))
langs.push(languages[lang]);langs.sort(function(a,b){if(a.uniq>b.uniq)return 1;if(a.uniq<b.uniq)return-1;return 0});for(var i=0;i<langs.length;++i)
{var language=jQuery("#language-template").html();var lang=langs[i];language=language.replace("{{LANGUAGE}}",lang.lang).replace("{{NAME}}",lang.user).replace("{{SIZE}}",lang.size).replace("{{LINK}}",lang.link);language=jQuery(language);jQuery("#languages").append(language)}}
body{text-align:left!important}#answer-list{padding:10px;float:left}#language-list{padding:10px;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="https://cdn.sstatic.net/Sites/codegolf/primary.css?v=f52df912b654"> <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><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><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td><a href="{{LINK}}">{{SIZE}}</a></td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td><a href="{{LINK}}">{{SIZE}}</a></td></tr></tbody> </table> 

• Do you not mean, "Golf you a quine for greater good!"? – Mateen Ulhaq May 3 '11 at 2:49
• @muntoo it's a play on "Learn you a Haskell for Great Good". – Rafe Kettler May 3 '11 at 2:52
• Did anybody notice that this is question 69? – aidan0626 Oct 24 '20 at 22:47

## Burlesque - 1 byte

Technically, this is a quine:

1


Technically, this is also a quine:

{1 2 3}


Pretty much any literal is a quine.

This is also a quine which doesn't use a simple literal:

,#Q2 SH ~- ",#Q" \/ .+ sh


The comma is not necessary if you launch burlesque in no-stdin mode.

# AppleScript, 2 Bytes

1



It's a little cheaty, but it is following the restrictions of a quine. If we don't count the trailing newline, then this solution becomes 1 byte - 1.

Whenever AppleScript has a final executed line of code, it prints the result of the last operation (whatever it is) to the command line.

text



Any class name has the same effect.

# DUP, 51 bytes

0"0.[34,0[$;$][,1+]#]$!%%!"0.[34,0[$;$][,1+]#]$!%%!


Try it here.

Well, DUP quines are possible, just really, really, long. I'll have to golf some more.

# Python 2 and 3 - 32 bytes

s='s=%r;print(s%%s)';print(s%s)


# reticular, 9 bytes

"'34'coo;


This captures the string '34'coo;, then wraps around. After that, the number 34 is pushed the stack, converted to a character with c, finally being outputted with o. The next o outputs the captured string, and ; terminates the program.

Other quines:

"'34'c~O;
"6@P2*c~O;


# Jelly, 6 bytes

There are two proper and payload capable "built-in" quines of 6-bytes:

“ØV”ṘV - takes no input
“ØV”   - make the string “ØV”
Ṙ  - print and yield left (prints “ØV”, yields “ØV”)
V - eval Jelly code (the code ØV yields the string “ṘV”)
- implicit return of the string “ṘV”, so the final output is “ØV”ṘV


and

“Øv”Ṙv - as above,  except:
v evals with an input, which in this case is empty; and
Øv yields “Ṙv”


A payload may be placed directly after the leading open quote in either.

## Straw, 10 bytes (non-competing)

(:%>>):%>>

• Link to language is dead. Also, why is this non-competing? – pppery Sep 18 '20 at 1:35

# PowerShell, 41 37 Bytes:

function q{"function q{$function:q};q"};q filter q{"filter q{$function:q};q"};q


Thanks to TimmyD for saving 4 bytes

• What interpreter / compiler does this work in? In this interpreter, this submission doesn't work (it outputs function q{End: { "function q{$function:q};q" }};q). – Loovjo Oct 6 '16 at 18:00 • @Loovjo Most online PowerShell interpreters use an open-source PoSH that's roughly equivalent to PowerShell v0.5 and lacking many features. The above works fine in an actual install on Windows. – AdmBorkBork Oct 7 '16 at 13:08 • At least in v4 on Windows 8.1, you can shave a few bytes using filter as follows -- filter q{"filter q{$function:q};q"};q for 37. – AdmBorkBork Oct 7 '16 at 13:09
• $MyInvocation.MyCommand.ScriptBlock is 2 bytes shorter but almost definitely cheating? – colsw Feb 22 '17 at 22:38 # Cheddar, 56 bytes Try this one online! let q='let q=%s%s%s;print IO.sprintf(q,@"39,q,@"39)';print IO.sprintf(q,@"39,q,@"39)  See the explanation below, except mentally replace % with IO.sprintf. Well darn. @ETHProductions came up with this solution before me.. This is the shortest I could come up with... Maybe some abuse of functional operators could help me. let q='let q=%s;print q%@"39+q+@"39';print q%@"39+q+@"39  Try it online! You can guess what the output is. This code can be divided into two parts: the string and the output. The string part: let q='let q=%s;print q%@"39+q+@"39';  is simply a formatting template. The output part: ;print q%@"39+q+@"39  formats the string. @"39 is char 39, or '. # Java 8, 94 bytes ()->{String s="()->{String s=%c%s%1$c;System.out.printf(s,34,s);}";System.out.printf(s,34,s);}


This is a lambda expression which prints its own source code to STDOUT. It uses a similar tactic to other Java quines here, but the lambda really helps cut down bytes.

If we wanted to be really cheeky and cut down two bytes, we could declare the lambda as x->, where x is an empty string, as according to meta, "taking no input" means you can assume empty input, and in function submissions input is given as a parameter.

## Python 3, 38 bytes

There are already a lot of Python quines, but as far as I can see this one hasn't been posted yet. Technically it is a statement that evaluates to a string representation of itself, but other submissions do similar things.

'.__repr__()[:-1]*2'.__repr__()[:-1]*2


This works in a similar way to many quines in 2D langauges with "edge-wrap", where "string mode" is entered, the whole program is pushed to the stack, then string mode is executed and the program runs, printing the string mode character (usually ") followed by the contents of the stack (i.e. the program's source) then exiting.

A breakdown of the statement is as follows:

'.__repr__()[:-1]*2'                   # A string containing the body of the program.
# .__repr__()[:-1]*2
.__repr__()        # The same string, but enclosed in single quote marks.
# '.__repr__()[:-1]*2'
[:-1]   # A splice that crops off the last character.
# '.__repr__()[:-1]*2
*2 # Repeat the string.
# '.__repr__()[:-1]*2'.__repr__()[:-1]*2


The reason I have used .__repr__() instead of repr(string) is because the quine relies on code following and not preceding the string. This is also why this is a statement and not a program; the print() function requires code before the string, which is not possible with this quine layout.

As you may have noticed, there's a much golfier statement that evaluates to this statement:

"'.__repr__()[:-1]*2"*2


But this isn't a quine, because it doesn't evaluate to itself.

• Unfortunately, I don't think this is valid, since it's an expression (and therefore a snippet) rather than a full program. – Esolanging Fruit Jul 30 '17 at 2:33

# D, 85 bytes

enum c=q{import std.stdio;void main(){write("enum c=q{"~c~"};mixin(c);");}};mixin(c);


>91>60>93>62>91>105>54>50>99>111>100>111>62>93>60>91>60>93>62>91>99>111>62>93[<]>[i62codo>]<[<]>[co>]


Try it online!

My first thought for writing a Threead quine was to store the entire data section as one large number, in order to get a good compression ratio. This doesn't work because a) % appears to be broken, and b) Threead doesn't support bignum arithmetic.

Instead, I wrote this solution, which works along the same lines as a brainfuck quine, storing the characters of the code section of the program as individual tape elements. Then we just have to scan the list once in order to print it as data, and again to print it as code.

Although Threead allows for three threads, and requires their use when performing binary operations, this style of quine uses only unary operations and thus there was no point in using more than one thread, so I just did everything inside the first.

## Explanation

>91>60>…>62>93            ASCII character codes of the rest of the program
[<]>                      Return the pointer to the start of the data
[                         While the current data cell is nonzero:
i62                        Place 62 (ASCII code of >) on a temporary tape cell
co                         Output it as a character (i.e. >)
d                          Delete the temporary tape cell
o                          Output the current data element as an integer
>]                        then continue the loop with the next data cell
<[<]>                     Return the pointer to the start of the data
[                         While the current data cell is nonzero:
co                         Output it as a character
>]                        then continue the loop with the next data cell

• Nice. Basically the same as mine but with > at the beginning. I like it – Riley Jan 16 '17 at 23:01
• I hope you don't mind that I used that trick in my new version :) – Riley Jan 16 '17 at 23:23
• @Riley: That's OK, we're pretty much all cooperating to improve the quine at this point. – user62131 Jan 16 '17 at 23:25

## AWK, 72 bytes

BEGIN{s="BEGIN{s=%c%s%c;printf s,34,s,34}";printf s,34,s,34}


In 6 years nobody had written an AWK solution :(

This can be run from command-line as:

awk 'BEGIN{s="BEGIN{s=%c%s%c;printf s,34,s,34}";printf s,34,s,34}'


or placed in a file, FILE and run as:

awk -f FILE


Note: no newline is printed so if storing in a file... the file shouldn't have an EOF in it... maybe? We can add an EOF by adding print statements but that adds 12 bytes. This happens to be my first ever quine. :) It took me a bit to figure out how to get the quotation marks, since I first wanted to use \" but I'd have to escape the \ and then escape that one... ASCII to the rescue :)

• After I posted this I was curious if there was an extant AWK quine example. Apparently so at nyx.net/~gthompso/self_awk.txt. Given that, I believe this might be the shortest possible AWK quine. – Robert Benson Feb 23 '17 at 21:07

# Bash, 65 bytes

set -o history
echo "set -o history"
history|tail -n 2|cut -c 8-


Bash disables the command-history function in scripts, but you can turn it on manually with 'set-o history'.

This first command is obviously not stored in the shell's history file, so the second command prints the same text to the terminal.

The third command pulls the last two out of the history file and cleans them up for displaying.

The output matches:

set -o history
echo "set -o history"
history|tail -n 2|cut -c 8-

• reads its source no matter what – Erik the Outgolfer Jun 15 '16 at 8:39

# dc, 16 bytes

[91Pn6120568P]dx


Try it online!

Nothing fancy, posting for completeness.

## Explanation

[91Pn6120568P]dx
91P              # Print "["
n             # Print the macro
6120568P     # Print "]dx" encoded as a number
[            ]dx  # Run macro on its own code


# Ohm, 22 20 bytes

-2 bytes thanks to Business Cat

"D34'DLaJL"D34'DLaJL


Try it online!

"D34'DLaJL"          # Push this string (everything after this)
D         # Duplicate
34'      # Push the character "
D     # Duplicate
L    # Print "
a   # Swap the top 2 elements
JL # Print the string, ", then the string again.

• You can save 2 bytes by replacing LLL with JL (in both occurrences). – Business Cat May 18 '17 at 17:56

# x86/DOS assembly, 4619 bytes

bits 16
org 256
mov ah,64
mov bx,1
mov cx,720
mov dx,b+16
int 33
mov cx,90
mov si,b+16
c:push cx
mov ah,64
mov bx,1
mov cx,6
mov dx,b
int 33
mov cx,7
a:push cx
mov al,[si]
shr al,4
cmp al,58
jb g
g:mov [b+8],al
lodsb
and al,15
cmp al,58
jb e
e:mov [b+9],al
mov ah,64
mov bx,1
mov cx,5
mov dx,b+6
int 33
pop cx
loop a
mov al,[si]
shr al,4
cmp al,58
jb h
h:mov [b+8],al
lodsb
and al,15
cmp al,58
jb n
n:mov [b+9],al
mov ah,64
mov bx,1
mov cx,4
mov dx,b+6
int 33
pop cx
loop c
mov ah,64
mov bx,1
mov cx,5
mov dx,b+11
int 33
mov ah,76
int 33
b   db 13,10,' db 0x  ,',13,10,'end'
db 0x62,0x69,0x74,0x73,0x20,0x31,0x36,0x0d
db 0x0a,0x6f,0x72,0x67,0x20,0x32,0x35,0x36
db 0x0d,0x0a,0x6d,0x6f,0x76,0x20,0x61,0x68
db 0x2c,0x36,0x34,0x0d,0x0a,0x6d,0x6f,0x76
db 0x20,0x62,0x78,0x2c,0x31,0x0d,0x0a,0x6d
db 0x6f,0x76,0x20,0x63,0x78,0x2c,0x37,0x32
db 0x30,0x0d,0x0a,0x6d,0x6f,0x76,0x20,0x64
db 0x78,0x2c,0x62,0x2b,0x31,0x36,0x0d,0x0a
db 0x69,0x6e,0x74,0x20,0x33,0x33,0x0d,0x0a
db 0x6d,0x6f,0x76,0x20,0x63,0x78,0x2c,0x39
db 0x30,0x0d,0x0a,0x6d,0x6f,0x76,0x20,0x73
db 0x69,0x2c,0x62,0x2b,0x31,0x36,0x0d,0x0a
db 0x63,0x3a,0x70,0x75,0x73,0x68,0x20,0x63
db 0x78,0x0d,0x0a,0x6d,0x6f,0x76,0x20,0x61
db 0x68,0x2c,0x36,0x34,0x0d,0x0a,0x6d,0x6f
db 0x76,0x20,0x62,0x78,0x2c,0x31,0x0d,0x0a
db 0x6d,0x6f,0x76,0x20,0x63,0x78,0x2c,0x36
db 0x0d,0x0a,0x6d,0x6f,0x76,0x20,0x64,0x78
db 0x2c,0x62,0x0d,0x0a,0x69,0x6e,0x74,0x20
db 0x33,0x33,0x0d,0x0a,0x6d,0x6f,0x76,0x20
db 0x63,0x78,0x2c,0x37,0x0d,0x0a,0x61,0x3a
db 0x70,0x75,0x73,0x68,0x20,0x63,0x78,0x0d
db 0x0a,0x6d,0x6f,0x76,0x20,0x61,0x6c,0x2c
db 0x5b,0x73,0x69,0x5d,0x0d,0x0a,0x73,0x68
db 0x72,0x20,0x61,0x6c,0x2c,0x34,0x0d,0x0a
db 0x61,0x64,0x64,0x20,0x61,0x6c,0x2c,0x34
db 0x38,0x0d,0x0a,0x63,0x6d,0x70,0x20,0x61
db 0x6c,0x2c,0x35,0x38,0x0d,0x0a,0x6a,0x62
db 0x20,0x67,0x0d,0x0a,0x61,0x64,0x64,0x20
db 0x61,0x6c,0x2c,0x33,0x39,0x0d,0x0a,0x67
db 0x3a,0x6d,0x6f,0x76,0x20,0x5b,0x62,0x2b
db 0x38,0x5d,0x2c,0x61,0x6c,0x0d,0x0a,0x6c
db 0x6f,0x64,0x73,0x62,0x0d,0x0a,0x61,0x6e
db 0x64,0x20,0x61,0x6c,0x2c,0x31,0x35,0x0d
db 0x0a,0x61,0x64,0x64,0x20,0x61,0x6c,0x2c
db 0x34,0x38,0x0d,0x0a,0x63,0x6d,0x70,0x20
db 0x61,0x6c,0x2c,0x35,0x38,0x0d,0x0a,0x6a
db 0x62,0x20,0x65,0x0d,0x0a,0x61,0x64,0x64
db 0x20,0x61,0x6c,0x2c,0x33,0x39,0x0d,0x0a
db 0x65,0x3a,0x6d,0x6f,0x76,0x20,0x5b,0x62
db 0x2b,0x39,0x5d,0x2c,0x61,0x6c,0x0d,0x0a
db 0x6d,0x6f,0x76,0x20,0x61,0x68,0x2c,0x36
db 0x34,0x0d,0x0a,0x6d,0x6f,0x76,0x20,0x62
db 0x78,0x2c,0x31,0x0d,0x0a,0x6d,0x6f,0x76
db 0x20,0x63,0x78,0x2c,0x35,0x0d,0x0a,0x6d
db 0x6f,0x76,0x20,0x64,0x78,0x2c,0x62,0x2b
db 0x36,0x0d,0x0a,0x69,0x6e,0x74,0x20,0x33
db 0x33,0x0d,0x0a,0x70,0x6f,0x70,0x20,0x63
db 0x78,0x0d,0x0a,0x6c,0x6f,0x6f,0x70,0x20
db 0x61,0x0d,0x0a,0x6d,0x6f,0x76,0x20,0x61
db 0x6c,0x2c,0x5b,0x73,0x69,0x5d,0x0d,0x0a
db 0x73,0x68,0x72,0x20,0x61,0x6c,0x2c,0x34
db 0x0d,0x0a,0x61,0x64,0x64,0x20,0x61,0x6c
db 0x2c,0x34,0x38,0x0d,0x0a,0x63,0x6d,0x70
db 0x20,0x61,0x6c,0x2c,0x35,0x38,0x0d,0x0a
db 0x6a,0x62,0x20,0x68,0x0d,0x0a,0x61,0x64
db 0x64,0x20,0x61,0x6c,0x2c,0x33,0x39,0x0d
db 0x0a,0x68,0x3a,0x6d,0x6f,0x76,0x20,0x5b
db 0x62,0x2b,0x38,0x5d,0x2c,0x61,0x6c,0x0d
db 0x0a,0x6c,0x6f,0x64,0x73,0x62,0x0d,0x0a
db 0x61,0x6e,0x64,0x20,0x61,0x6c,0x2c,0x31
db 0x35,0x0d,0x0a,0x61,0x64,0x64,0x20,0x61
db 0x6c,0x2c,0x34,0x38,0x0d,0x0a,0x63,0x6d
db 0x70,0x20,0x61,0x6c,0x2c,0x35,0x38,0x0d
db 0x0a,0x6a,0x62,0x20,0x6e,0x0d,0x0a,0x61
db 0x64,0x64,0x20,0x61,0x6c,0x2c,0x33,0x39
db 0x0d,0x0a,0x6e,0x3a,0x6d,0x6f,0x76,0x20
db 0x5b,0x62,0x2b,0x39,0x5d,0x2c,0x61,0x6c
db 0x0d,0x0a,0x6d,0x6f,0x76,0x20,0x61,0x68
db 0x2c,0x36,0x34,0x0d,0x0a,0x6d,0x6f,0x76
db 0x20,0x62,0x78,0x2c,0x31,0x0d,0x0a,0x6d
db 0x6f,0x76,0x20,0x63,0x78,0x2c,0x34,0x0d
db 0x0a,0x6d,0x6f,0x76,0x20,0x64,0x78,0x2c
db 0x62,0x2b,0x36,0x0d,0x0a,0x69,0x6e,0x74
db 0x20,0x33,0x33,0x0d,0x0a,0x70,0x6f,0x70
db 0x20,0x63,0x78,0x0d,0x0a,0x6c,0x6f,0x6f
db 0x70,0x20,0x63,0x0d,0x0a,0x6d,0x6f,0x76
db 0x20,0x61,0x68,0x2c,0x36,0x34,0x0d,0x0a
db 0x6d,0x6f,0x76,0x20,0x62,0x78,0x2c,0x31
db 0x0d,0x0a,0x6d,0x6f,0x76,0x20,0x63,0x78
db 0x2c,0x35,0x0d,0x0a,0x6d,0x6f,0x76,0x20
db 0x64,0x78,0x2c,0x62,0x2b,0x31,0x31,0x0d
db 0x0a,0x69,0x6e,0x74,0x20,0x33,0x33,0x0d
db 0x0a,0x6d,0x6f,0x76,0x20,0x61,0x68,0x2c
db 0x37,0x36,0x0d,0x0a,0x69,0x6e,0x74,0x20
db 0x33,0x33,0x0d,0x0a,0x62,0x20,0x20,0x20
db 0x64,0x62,0x20,0x31,0x33,0x2c,0x31,0x30
db 0x2c,0x27,0x20,0x64,0x62,0x20,0x30,0x78
db 0x20,0x20,0x2c,0x27,0x2c,0x31,0x33,0x2c
db 0x31,0x30,0x2c,0x27,0x65,0x6e,0x64,0x27
end


# 80x86 TASM, 561 bytes

MODEL TINY
.CODE
.STARTUP
DB 177
DB 076
DB 186
DB 044
DB 001
DB 172
DB 180
DB 036
DB 179
DB 004
DB 191
DB 080
DB 001
DB 079
DB 136
DB 037
DB 212
DB 010
DB 004
DB 048
DB 134
DB 196
DB 075
DB 117
DB 244
DB 180
DB 009
DB 205
DB 033
DB 178
DB 071
DB 226
DB 228
DB 178
DB 038
DB 205
DB 033
DB 195
DB 013
DB 010
DB 069
DB 078
DB 068
DB 036
DB 077
DB 079
DB 068
DB 069
DB 076
DB 032
DB 084
DB 073
DB 078
DB 089
DB 013
DB 010
DB 046
DB 067
DB 079
DB 068
DB 069
DB 013
DB 010
DB 046
DB 083
DB 084
DB 065
DB 082
DB 084
DB 085
DB 080
DB 013
DB 010
DB 068
DB 066
DB 032
END

• @Downvoter I can kind of understand the downvotes on all the quines I posted from RosettaCode, but this one, really? – MD XF May 25 '17 at 17:23

# ACL2, 41 bytes

(let((q"(let((q~x0))(cw q q))"))(cw q q))


# Vim, 27 bytes

ii^V^V^V^[BDuplxbbpp^[BDuplxbbpp


^V being CTRL+V and ^[ being ESC.

The other one is beating mine, but it took a while and I didn't think it was possible.

# Excel, 131 bytes

=SUBSTITUTE("=SUBSTITUTE(@,CHAR(64),CHAR(34)&@&CHAR(34))",CHAR(64),CHAR(34)&"=SUBSTITUTE(@,CHAR(64),CHAR(34)&@&CHAR(34))"&CHAR(34))


Adapted from a program by Dave Burt.

# Go, 112 bytes

As far as I can tell, there's no Go answer here. Here's mine and I think this is the shortest possible.

package main;import.fmt;func main(){s:="package main;import.fmt;func main(){s:=%q;Printf(s,s)}";Printf(s,s)}


Try it online!

# QBIC, 8 bytes

?A+@?A+@


I was trying to do this, but I accidentally golfed an actual quine. Whadda you know?

## Explanation

?           Print
A            A$+ concatenated with @ a string literal containing ?A+@ "?A+@"  When A$ is used the first time, it might not seem to have a value yet, but it already contains the string literal ?A+@ because the QBIC interpreter first scans the code, sees the @, looks up what the first available string variable is (it's A$, because it hasn't been used by other QBIC language features yet), and it then extracts the definition A$ = "?A+@" to the top of the file, and inserts A\$ at the place where it found the literal.

# Micro, 5 bytes

{_BS}


## Explination:

{_BS}

{      start a code block (this block will be run due to implicit evaluation)
_     push the item most recently popped. this pushes the code block which was popped due to implicit evaluation
BS}  convert the code block to a string, and end the block. Micro's implicit evaluation is weird, because the evaluated variable may generate new items on the stack, in which case the program's execution will continue as if it hadn't ended. this second implicit evaluation displays the string which is left on the stack: "{_BS}", and ends execution.


f:(c{"f:(c{"")]concat(substr(c,0,6),c,substr(c,6,41))")]concat(substr(c,0,6),c,substr(c,6,41))


Watch out for quotation marks autocompletion in the editor!

This should create a parameterless function f which returns its own code.

This quine makes use of (another) weird feature of Mathcad: you can put as much quotation marks inside a string as you like. No idea how they handle it...

# JScript, 175 bytes

WScript.Echo((k="WScript.Echo((k=\"%Z\").replace(/%[Z]/,k.replace(/[\"\\\\]/g,function(e){return\"\\\\\"+e})))").replace(/%[Z]/,k.replace(/["\\]/g,function(e){return"\\"+e})))


JScript is Microsoft's implementation of the JavaScript language. On a microsoft console, you can invoke the program as <name>.js, and this will output to a popup. To output to the console, one must use:

cscript //E:JScript //nologo <name>.js


and add a trailing CRLF to the source code.

## Zsh, 17 bytes

sed p<<a
sed p<<a


## Foam, 15 bytes

[. <' |: ~|]: ~


This prints itself with a trailing newline. Without a trailing newline:

[. .' |: ~|]: ~


# Gaia, 10 bytes

“:ṙpp”:ṙpp


Try it online!

### Explanation

“:ṙpp”      Push this string.
:     Copy it.
ṙ    Get the string representation of it.
p   Print the string representation.
p  Print the string.