Learn To Program
Increase Your Knowlegde and Build Your Skill!
Pages
(Move to ...)
Home
Me
▼
Monday, December 20, 2010
Method In Ruby
To say mooooo:
>> def sayMoo
>> puts 'Mooooooooooo...'
>> end
To call it, just type:
>> sayMoo
Method with parameter:
>> def sayMoo num
>> puts 'Mooooooooo...'*num
>> end
Call it by
>> sayMoo 5 # print 5 times
No comments:
Post a Comment
‹
›
Home
View web version
No comments:
Post a Comment