Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • \$\begingroup\$ Let me guess… Too many Python coding in the last time? \$\endgroup\$ Commented Nov 24, 2015 at 16:01
  • 1
    \$\begingroup\$ Some minor syntax changes: ARGV$*; each_charchars; do..end{..}; printf$><< + % would lead to this: "qwertyuiop↵asdfghjkl↵zxcvbnm".split($*[0])[1].chars{|i|$><<"%s "%i}. More in Tips for golfing in Ruby. \$\endgroup\$ Commented Nov 24, 2015 at 16:09
  • \$\begingroup\$ @manatwork First time trying to golf in Ruby, thanks for the tips/link! \$\endgroup\$ Commented Nov 24, 2015 at 16:10
  • 1
    \$\begingroup\$ I see you didn't got the hint in my first comment. In Ruby there is no need for triple quotes around multiline strings. (Actually I had no idea until now that it accepted by Ruby.) \$\endgroup\$ Commented Nov 24, 2015 at 16:21
  • 1
    \$\begingroup\$ The leading spaces in the output are quite ugly. As . in regular expression does not match \n by default, better use that for the spacing: puts"qwertyuiop↵asdfghjkl↵zxcvbnm ".split($*[0])[1].gsub(/./,'\& '). Though the code length will remain the same. \$\endgroup\$ Commented Nov 24, 2015 at 16:38