#first program
#function defination
def say_goodnight(name)
  result = "Good night, #{name}"
  return result
end
#function invoke
puts say_goodnight('Pa')
#capitalize method
def say_goodnight(name)
  result = "Good night, #{name.capitalize}"
  return result
end
puts say_goodnight('pa')
#Ruby uses a convention to help it distinguish the usage of a name:the first characters of a name indicate how the name is used.
#Local variables,method parameters,and method names should all start with a lowercase letter or with an underscore.
#Global variables are prefixed with a dollar sign($),and instance variables begin with an "at" sign(@).
#Class variables start with two "at" signs(@@).
#Finally,class names,module names,and constants must start with an uppercase letter.
                    
                
                
            
        
浙公网安备 33010602011771号