Ruby/Method/def
Материал из Wiki.crossplatform.ru
(Различия между версиями)
ViGOur (Обсуждение | вклад) м (1 версия: Импорт выборки материалов по Ruby) |
Текущая версия на 17:55, 13 сентября 2010
def and end define the welcome method:
def welcome puts "Welcome to Ruby methods." end welcome
define your own method with def/end
def hello puts "Hello, Matz!" end hello # => Hello, Matz!
Use def to define a function
def dog_barking puts "Woof!" end dog_barking