Quine: Difference between revisions
Ruby: delete the more verbose file-reading example, as the next example is equivalent and simpler
(fix Ruby’s last two examples, which were incorrect) |
(Ruby: delete the more verbose file-reading example, as the next example is equivalent and simpler) |
||
Line 3,512:
<lang ruby>eval s="puts'eval s='+s.inspect"</lang>
An implementation that reads and prints the file the code is stored in (which violates some definitions of “quine”):
<lang ruby>puts open(__FILE__).read</lang>
As the above implementation depends on the code being saved in a file, it doesn’t work in IRB.
=={{header|Rust}}==▼
▲=={{header|Rust}}==
A short quine (works with Rust 1.3.0):
|