Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!

Idiom #182 Quine program

Output the source of the current program. A quine is a computer program that takes no input and produces a copy of its own source code as its only output.

Reading the source file from disk is cheating.

fn main(){print!("{},{0:?})}}","fn main(){print!(\"{},{0:?})}}\"")}
fn main() {
    let x = "fn main() {\n    let x = ";
    let y = "print!(\"{}{:?};\n    let y = {:?};\n    {}\", x, x, y, y)\n}\n";
    print!("{}{:?};
    let y = {:?};
    {}", x, x, y, y)
}
int main(){char*s="int main(){char*s=%c%s%c;printf(s,34,s,34);return 0;}";printf(s,34,s,34);return 0;}

New implementation...
< >
a