ruby - What does the "s" do in this code? -
ruby - What does the "s" do in this code? -
the next code ruby implementation of caesar cypher:
def caeser(s,n)s.gsub(/./){|c|(c.ord+n).chr}end
it given solution problem here: http://www.sitepoint.com/ruby-golf/
what purpose of "s" @ end of caeser(s,n)s
.
without "s", code doesn't work.
i think this:
def caeser(s,n) s.gsub(/./){|c|(c.ord+n).chr} end
ruby syntax
Comments
Post a Comment