Skip to content

Instantly share code, notes, and snippets.

@florian
Created November 17, 2018 10:20
Show Gist options
  • Save florian/7116152ba0590b63f6c7d283a2e59d92 to your computer and use it in GitHub Desktop.
Save florian/7116152ba0590b63f6c7d283a2e59d92 to your computer and use it in GitHub Desktop.
Quine

Notes:

  • Using heredocs made it easier to write the quine. In Python the same approach would've required a lot more escaping quotes
  • New lines would make the code more readable. I didn't bother because ignoring that makes the quine slightly simpler and shorter
s = <<-STR
puts("s = <<-STR"); print(s); puts("STR"); print(s);
STR
puts("s = <<-STR"); print(s); puts("STR"); print(s);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment