Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
A Hands-On Introduction to Ruby
Search
Zach Latta
July 27, 2013
Programming
970
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
A Hands-On Introduction to Ruby
A brief introduction to the wonderful world of Ruby.
Zach Latta
July 27, 2013
More Decks by Zach Latta
See All by Zach Latta
The Art of Code
zach
0
170
Start a Hack Club
zach
0
150
Curiosity, Education, And What We Can Do Better
zach
1
640
Introduction to the Command-Line
zach
0
150
Other Decks in Programming
See All in Programming
Webの地図
yosuke_furukawa
PRO
6
4.7k
What We Talk About When We Talk About XP
m_seki
2
670
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
650
速習iPhone Duo対応
yuukiw00w
1
710
Are APIs Still Relevant in the AI Era?
soyuka
0
300
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
390
The Rails Doctrine Decade
koic
2
330
XP祭りでしか伝わらないフリップネタ #xpjug
murabayashi
0
150
Heart of Swift Concurrency
koher
0
950
iOSDC2026登壇資料.pdf
riofujimon
0
180
thread_parallel_with_free-threaded_Python_and_NumPy.pdf
riku_sakamoto
0
350
標準パッケージに uuid が追加された 背景から見る Go らしい意思決定 / go_127_uuid_decision
convto
5
8.2k
Featured
See All Featured
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3k
4 Signs Your Business is Dying
shpigford
187
23k
How to Ace a Technical Interview
jacobian
281
24k
Thoughts on Productivity
jonyablonski
76
5.4k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
560
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
500
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.5k
The Invisible Side of Design
smashingmag
301
52k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
770
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
280
Transcript
RUBY zach latta a hands-on introduction to
ruby is a high productivity scripting language
Japan made in designed by matsumoto yukihiro
matz
None
None
None
None
...and many more
it’s fun idiomatic poignant not java
objects. objects everywhere.
1 "DO NOT USE ALL CAPS".downcase => "do not use
all caps" valid ruby 2 5.rationalize => (5/1)
i can’t believe it’s not english!
1 5.times { print "hi" } => "hihihihihi" print “hi”
five times 2 print "hi" * 5 => "hihihihihi"
1 import java.io.* 2 3 public class Hi 4 {
5 public static void main(String[] args) 6 { 7 for (int i = 0; i < 5; i++) 8 { 9 System.out.print("hi"); 10 } 11 } 12 } …and in java
quickly and easily understand other ruby
1 print 'This is not a '\ 'palindrome'.reverse => "emordnilap
a ton si sihT"
“code so beautiful that tears are shed” - why’s poignant
guide to ruby
1 puts "What is your name?" 2 name = gets.strip!
3 4 puts "Hello #{ name }. How are you?" greetings
! 1 import java.util.Scanner; 2 3 public class ALessNiceGreeting 4
{ 5 public static void main(String[] args) 6 { 7 Scanner scanner = new Scanner(System.in); 8 9 System.out.println("What is your name?"); 10 String name = scanner.nextLine().trim(); 11 12 System.out.println("Hi " + name + ". How are you?"); 13 14 scanner.close(); 15 } 16 } greetings (cont.)
1 contents = File.read('file.txt') 2 puts contents file io
1 import java.io.BufferedReader; 2 import java.io.FileReader; 3 import java.io.IOException; 4
5 public class BufferedReaderExample 6 { 7 public static void main(String[] args) 8 { 9 BufferedReader br = null; 10 11 try 12 { 13 14 String sCurrentLine; 15 16 br = new BufferedReader(new FileReader("file.txt")); 17 18 while ((sCurrentLine = br.readLine()) != null) 19 { 20 System.out.println(sCurrentLine); 21 } 22 23 } 24 catch (IOException e) 25 { 26 e.printStackTrace(); 27 } 28 finally 29 { 30 try 31 { 32 if (br != null)br.close(); 33 } 34 catch (IOException ex) 35 { 36 ex.printStackTrace(); 37 } 38 } 39 40 } 41 } file io (cont.)
power simplicity vs.
1 def a_method 2 puts "Hello world!" 3 end methods
1 get ‘/‘ do 2 'Hello world!' 3 end dsl
gems
bogosort while !sorted(deck) { shuffle(deck) }
bogosort best case: ΩΩ(n) worst case: Unbounded average case: O(n
× n!)
• http://mislav.uniqpath.com/ poignant-guide/ • http://tryruby.org • make something!
github.com/zachlatta/baas speakerdeck.com/zach/a- hands-on-introduction-to-ruby
[email protected]
e: w: zachlatta.com g: github.com/zachlatta