def foo(bar: 'default')
puts bar
end
foo # => 'default'
foo(bar: 'baz') # => 'baz'
def show_name_and_address(name: "Someone", address: "Somewhere")
puts "#{name}, #{address}"
end
show_name_and_address
#=> 'Someone, Somewhere'
show_name_and_address(name: 'Andy')
#=> 'Andy, Somewhere'
show_name_and_address(address: 'USA')
#=> 'Someone, USA'
def show_name_and_address(name="Someone", address="Somewhere")
puts "#{name}, #{address}"
end
show_name_and_address
#=> 'Someone, Somewhere'
show_name_and_address('Andy')
#=> 'Andy, Somewhere'
Code Example |
---|
Ruby :: JSON.parse prevent error ruby |
Ruby :: sidekiq configuration file |
Ruby :: ruby assign rest of array |
Ruby :: ruby adding an item to a hash |
Ruby :: ruby null |
Ruby :: sequel alter table |
Ruby :: add several columns rails |
Ruby :: rails scope alias |
Ruby :: ruby on rails collapse array |
Ruby :: pick element from space separated list that is part of params hash |
Ruby :: Ruby deep clone with Marshal |
Ruby :: ruby sinatra enable sessions |
Ruby :: comment |
Ruby :: rails decode cookie |
Ruby :: ruby substring |
R :: outlier tagging boxplot r |
R :: remove line with na r |
R :: reverse row order dataframe R |
R :: plot3d in r |
R :: pi in r |
R :: how to build random forest in r |
R :: regex in r |
R :: how to use ifelse in r |
R :: mean in r |
R :: Reorder bars in geom_bar ggplot2 by value |
R :: Remove specific data frames from R |
R :: unite r function how to include in dataframe |
R :: sparklyr alternative for str_detect |
R :: end the program in r |
R :: remove the colour name from ggplot |