One Byte Explainer: What is a quine?

One Byte Explainer: What is a quine?


This is a submission for DEV Computer Science Challenge v24.06.12: One Byte Explainer.



Explainer

The answer is “The answer is”.
Also called a self-replicating program, a quine is a computer program that outputs its own source code. The sentence above tries to mimic one. Its practicality can be arguable, but it’s an amusing metaprogramming concept.



Additional Context

Here is an example in JavaScript, adapted from Dylan Beattie’s beautiful talk The Art of Code:

(f = () => console.log(`(f = ${f})()`))()
Enter fullscreen mode

Exit fullscreen mode

When you run it, the output is:

(f = () => console.log(`(f = ${f})()`))()
Enter fullscreen mode

Exit fullscreen mode

Cover image by ANIRUDH on Unsplash.



Source link
lol

By stp2y

Leave a Reply

Your email address will not be published. Required fields are marked *

No widgets found. Go to Widget page and add the widget in Offcanvas Sidebar Widget Area.