Answers for "ruby cheat sheet pdf 2020"

1

best ruby cheat sheet

def greeting(hello, *names) # *name is a splat argument, takes several parameters passed in an array
  return "#{hello}, #{names}"
end

start = greeting("Hi", "Justin", "Maria", "Herbert") # call a method by name

def name(variable=default)
  ### The last line in here get's returned by default
end
Posted by: Guest on January-04-2021
0

best ruby cheat sheet

i = 0
loop do
  i += 1
  print "I'm currently number #{i}” # a way to have ruby code in a string
  break if i > 5
end
Posted by: Guest on January-04-2021

Browse Popular Code Answers by Language