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

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -