Created
July 1, 2016 19:32
-
-
Save glv/26b4ff03f4cbc4b768f363a64d4d791c to your computer and use it in GitHub Desktop.
Dave Thomas' Ruby puzzler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# What is the value of this Ruby expression? | |
% % % % % | |
# There's a trailing space, which is important! | |
# It evaluates to "%". Why? It's equivalent to this: | |
%|%|% %|%| | |
# which parses as: | |
'%' % '%' | |
# which is equivalent to: | |
sprintf('%s', '%') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment