Netsoc Ruby TutorialShane hduairc@netsoc.tcd.ieiJanuary 13, 2009Shane hduairc@netsoc.tcd.iei () Netsoc Ruby Tutorial January 13, 2009 1 / 23Contents of this Tutorial1 IntroductionWhat is Ruby?About this Tutorialirb - the Interactive Ruby Shell2 Problems and Solutions in RubyProblem 1: Hello, world! 2: Silly binary stu Problem 3: Iterators 4: 2 + 2 = 5Problem 5: I am Vinny 6: Hash-like thing (Map)Problem 7: Adding accessor methods to Map 8: BetterrdsProblem 9: Turning Map into a mixin 10: Improving the mixinProject Euler 1: Higher-order functions in Ruby3 Further ReadingShane hduairc@netsoc.tcd.iei () Netsoc Ruby Tutorial January 13, 2009 2 / 23Introduction What is Ruby?What is Ruby?This is Ruby:5.times {puts "Hello, world!"}Ruby:Is a dynamic, object-oriented programming language.Combines the semantics of Smalltalk with Perl-inspired syntax.Everything is an object, even 5.Shane hduairc@netsoc.tcd.iei () Netsoc Ruby Tutorial January 13, 2009 3 / 23Introduction What is Ruby?What is Ruby?This is Ruby:5.times {puts "Hello, world!"}Ruby:Is a dynamic, object-oriented programming language.Combines the semantics of Smalltalk with Perl-inspired syntax.Everything is an object, even 5.Shane hduairc@netsoc.tcd.iei () Netsoc Ruby Tutorial January 13, 2009 3 / 23Introduction What is Ruby?What is Ruby?This is Ruby:5.times {puts "Hello, world!"}Ruby:Is a dynamic, object-oriented programming language.Combines the semantics of Smalltalk with ...
Voir