Reputation: 4538
I just found a CodeGolf
answer here http://repl.it/2Om/6:
puts"The eight#{e="een-hundreds were a time for "}rum.
The ninet#{e}fun.
The two-thousands are a time to run
a civilized classroom.
"*(?X-??)
Original post: https://codegolf.stackexchange.com/a/40250
I am curious, how does it work? I have never seen (?X-??)
before. What's happening here?
Upvotes: 0
Views: 91
Reputation: 874
?Char gives the ASCII code of Char.
?X = "X".ord = 88
?? = "?".ord = 63
?X - ?? = 88-63 = 25
There is your integer: 25
Then "a"*25 = "aaaaaaaaaaaaaaaaaaaaaaaaa"
Upvotes: 4