Advertisement
Hiteshw11

Method with default parameters in ruby

Sep 25th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.17 KB | None | 0 0
  1. def welcome(name="no name",age="nil")
  2.   puts ("Your name is "+name+ " and your age is "+age.to_s)
  3. end
  4.  
  5. #We are not entering any parameters to see the default values
  6. welcome
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement