-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
1193 lines (1027 loc) · 36.8 KB
/
index.html
File metadata and controls
1193 lines (1027 loc) · 36.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - The HTML Presentation Framework</title>
<meta name="description" content="A framework for easily creating beautiful presentations using HTML">
<meta name="author" content="Hakim El Hattab">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/night.css" id="theme">
<!-- Code syntax highlighting -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h2>Intro to Programming</h1>
<h2>Using Ruby</h2>
<p>
<p>Created by</p>
<small>Vaidehi Joshi <a href="https://twitter.com/vaidehijoshi">@vaidehijoshi</a></small>
<small>//</small>
<small> Natasha Jones <a href="http://twitter.com/latazzajones">@latazzajones</a></small>
</p>
<a href="#/1">Day 1</a> // <a href="#/28">Day 2</a> // <a href="#/48">Day 3</a> // <a href="#/69">Day 4</a>
</section>
<!-- Slide 1 = we introduce ourselves and how we got into programming -->
<!-- DAY 1 -->
<section>
<h2>Day 1</h2>
</section>
<section>
<h2>Vaidehi Joshi</h2>
<img width="auto" height="476" data-src="http://vaidehi.weebly.com/uploads/2/6/6/2/2662213/1426816888.png" alt="Vaidehi!!!" style="float: left">
<br>
<span style="padding: 1em">
<h3 class="fragment">14 months of code</h3>
<h3 class="fragment">9 months of ruby</h3>
<h3 class="fragment">6 months of working as a developer</h3>
</span>
</section>
<section>
<h2>Tasha Jones</h2>
<img width="auto" height="476" data-src="assets/yay.jpg" alt="Tasha!!!" style="float: left">
<span style="padding: 1em">
<h3 class="fragment">14 months of code</h3>
<h3 class="fragment">12 months of ruby</h3>
<h3 class="fragment">6 months of working as a developer</h3>
</span>
</section>
<!-- Course Outline -->
<section>
<h2>What</h2>
<ol>
<li class="fragment">The command line</li>
<li class="fragment">Running scripts/programs</li>
<li class="fragment">Building blocks of Ruby, of course</li>
<li class="fragment">Version control with Git + GitHub</li>
</ol>
<br>
</section>
<section>
<h2>How</h2>
<h4>Chris Pine's <i>Learn To Program</i></h4>
<img width="auto" height="350" src="https://pine.fm/images/LTP2_cover.jpg">
<p>
<a href="http://kysmykseka.net/koti/wizardry/Programming/Pragmatic%20Programmers/Learn%20to%20Program%202nd%20Edition.pdf" target="blank">Learn to Program PDF</a>
</p>
</section>
<section>
<h2>Our Expectations</h2>
<p class="fragment">Always ask, because everyone else has the same question.</p>
<p class="fragment">You're not stupid, this is just freaking <i>hard</i>.</p>
<p class="fragment">You won't get everything. You will have to work at it.</p>
<p class="fragment">Come prepared, give it your all.</p>
<p class="fragment">Use your resources (Saturdays!)</p>
<p class="fragment">Help each other level up and we'll all learn more.</p>
</section>
<section>
<h2>Your Expectations</h2>
<br>
<h3>Who are you?</h3>
<h3>Why are you here?</h3>
</section>
<!-- talk about the history of the command line -->
<section>
<h2>Your New Best Friend</h2>
<h3>The Command Line (or Terminal)</h3>
<p class="fragment">How we communicate with our computer</p>
<p class="fragment">Where we run scripts</p>
<p class="fragment">Where we look cool</p>
<p class="fragment">Have you installed xCode? Make sure you do that today.</p>
</section>
<section>
<h2>The Command Line! For mac</h2>
<iframe width="560" height="315" src="https://www.youtube.com/embed/vJYfXUgayxw" frameborder="0" allowfullscreen></iframe>
</section>
<section>
<h2>The Command Line! For pc</h2>
<iframe width="560" height="315" src="https://www.youtube.com/embed/zixpms1oo40" frameborder="0" allowfullscreen></iframe>
</section>
<!-- short demo of -ls -cd -.. -pwd -->
<!-- 5-7 minutes going to cli the hard way and playing around with CLI prompts -->
<section>
<h2>Commands!</h2>
<div>
<a href="http://cli.learncodethehardway.org/book/">Learn Command Line the Hard Way</a>
</div><br>
<ul>
<li class="fragment">pwd: <em>present working directory</em></li>
<li class="fragment">cd: <em>change directory</em></li>
<li class="fragment">ls: <em>list directory</em></li>
</ul>
</section>
<!-- install ruby -->
<section data-markdown>
<script type="text/template">
## Get Yo Ruby On
Download ruby for [mac](https://rvm.io/rvm/install).
Download ruby for [windows](http://rubyinstaller.org/).
```
curl -sSL https://get.rvm.io | bash -s stable --ruby
```
</script>
</section>
<!-- install sublime text -->
<section>
<h2>Get Yo Sublime On</h2>
<a href="http://www.sublimetext.com/">Sublime Text</a>
<p>Text editors are where our ruby files live!</p>
</section>
<!-- Abridged using Learn To Program's Chapter 2 -->
<section data-markdown>
<script type="text/template">
## Write a Program!
- Open your text editor
- Save your file to the desktop as `calc.rb`
- Type:
```
puts 1 + 2
puts 3
puts 1.0 + 2.0
puts 2.0 * 3.0
puts 5.0 - 8.0
puts 9.0 / 2.0
puts 10 % 3
```
<p class="fragment">(What is `%` doing? This is called a **modulo**)</p>
</script>
</section>
<section>
<h2>Numbers:</h2>
<ul>
<li class="fragment"><em>Integers</em>: numbers without decimal points.</li>
<li class="fragment"><em>Floats</em>: numbers with decimal points.</li>
<li class="fragment"><em>Operations</em>: basic arithmetic operators (which are actual methods in ruby!)</li>
</ul>
</section>
<section data-markdown>
<script type="text/template">
## Time To Run Our Program!
- <span class="fragment">Open your command line</span>
- <span class="fragment">Type: `pwd`
- <span class="fragment">If you are not in your `/Desktop` directory, `cd` into it
- <span class="fragment">Run this command:
```
ruby calc.rb
```
</script>
</section>
<section data-markdown>
<script type="text/template">
## So...what happened?
```
[11:54:32] Desktop
♥ ruby calc.rb
3
3
3.0
6.0
-3.0
4.5
```
</script>
</section>
<!-- slides to insert here:
turn all of our numbers into strings
talk about the difference between numbers and strings in programming
different data types
-->
<section data-markdown>
<script type="text/template">
## Strings vs. Numbers
- <span class="fragment">*Numbers*: integer or a float</span>
- <span class="fragment">*Strings*: characters, words, sentences. Basically, anything can be a string if it's within `"` or `'` quotes</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## Escaping characters in strings
### The backslash: `\`
<span class="fragment">`puts 'Hello, what\'s your name?'`</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## Different data types do not play well together
- <span class="fragment">This will break
```
'dog' + 5
```
</span>
- <span class="fragment">This will **not** break
```
'dog' + '5'
```
</span>
- <span class="fragment">And neither will this
```
'dog' + 5.to_s
```
</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## `to_s`
### <span class="fragment">is a method.</span>
### <span class="fragment">Don't worry about it.</span>
## <span class="fragment">But it does **DO** something.</span>
#### <span class="fragment">What do you think it does?</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## Let's write our program:
- <span class="fragment">Open your `calc.rb` file and type:
```
puts "cat" + 2
puts "3"
puts 1.0 + 2.0 + "addition!"
puts "you" + "are" + "programming!"
puts "programming" * 3
puts "9.0 / 2.0"
```
</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## Run Our Program!
###<span class="fragment">`ruby calc.rb`</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## Did you get this ...?
```
[11:54:32] Desktop
♥ ruby calc.rb
cat 2
3
3 addition!
you are programming!
programming
programming
programming
9.0 / 2.0
```
###<span class="fragment">maybe you got something more like this..?</span>
<br>
<span class="fragment">
`#<TypeError: no implicit conversion of Fixnum into String>`
</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## Your first bug.
## Welcome to code.
- <span class="fragment">Figure out why this error might happen:
```
<TypeError: no implicit conversion of Fixnum into String>
```
</span>
- <span class="fragment">Fix it in your code -- there's more than one way!</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## Review
- <span class="fragment">Set up + install.</span>
- <span class="fragment">Introduced the command line.</span>
- <span class="fragment">Created + ran our first program.</span>
- <span class="fragment">Learned about numbers + operations.</span>
- <span class="fragment">Learned about strings.</span>
- <span class="fragment">And data types.</span>
- <span class="fragment">AND a method!</span>
</script>
</section>
<!-- homework slide! -->
<section data-markdown>
<script type="text/template">
## Homework
1. <span class="fragment">Teach yourself about the `mkdir` command:
- Try to create your own folder on your desktop called `Development`(if this is challenging - do it from your GUI)
- Create a file in that folder called `numbers_and_letters.rb`
- Do the rest of your homework in that file!
</span>
2. <span class="fragment">Check out the Homework for Week 1!
- https://github.com/latazzajones/Intro-to-Programming-Using-Ruby/wiki/Exercises
</span>
3. <span class="fragment">Use some strings to elaborate on your program and create more complete answers from 2.5:
```
"There are " + 24.to_s + " hours in a day."
```
</span>
</script>
</section>
<!-- DAY 2 -->
<section data-markdown>
<script type="text/template">
## Day 2
</script>
</section>
<section data-markdown>
<script type="text/template">
## Recap From Last Week
- Pair programming / pairing
- Ruby: what is it good for?
</script>
</section>
<section data-markdown>
<script type="text/template">
## Ruby in Context
<img width="auto" height="476" data-src="http://upload.wikimedia.org/wikipedia/commons/7/76/Yukihiro_Matsumoto.JPG" alt="Vaidehi!!!" style="float: left">
<br>
"I hope to see Ruby help every programmer in the world to be productive, and to enjoy programming, and to be happy. That is the primary purpose of Ruby language." -- Matz
<br>
<p>1995: Ruby 1.8 released</p>
<p>2004: "Programming Ruby" released</p>
<p>2005: Rails Framework released</p>
</script>
</section>
<section data-markdown>
<script type="text/template">
## Homework Review!
</script>
</section>
<section data-markdown>
<script type="text/template">
## More command line commands
- <span class="fragment">`mkdir`</span>
- <span class="fragment">`touch`</span>
- <span class="fragment">`rm`</span>
- <span class="fragment">`rm -rf`</span>
- <span class="fragment">`grep pattern filename(s)`</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## Make a new file in our `Development` folder
#### <span class="fragment">Create and open a file called `variables.rb`</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
### Let's write some strings!
#### <span class="fragment">Write a program that `puts` this phrase `20` times:</span>
<span class="fragment">`I saw Susie sitting in a shoe shine shop. Where she sits she shines, and where she shines she sits.`</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## There's gotta be a better way!
<iframe width="420" height="315" src="https://www.youtube.com/embed/wwROPN3Fir8?rel=0&showinfo=0" frameborder="0" allowfullscreen></iframe>
</script>
</section>
<section data-markdown>
<script type="text/template">
##And there is!
- <span class="fragment">*Variables*: references, pointers, labels to things!</span>
- <span class="fragment">Those things are generally *data*, and in Ruby, all data are objects.</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## Let's define some variables in the console
### <span class="fragment">In your terminal, type `irb`</span>
### <span class="fragment">`irb` stands for "Interactive Ruby Shell"</span>
### <span class="fragment">`irb` is your playground!</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## How do you define a variable?
```
> vaidehi = "Vaidehi"
> t = "Tasha"
> x = 3
> y = 5
```
<span class="fragment">
What can you do with variables?
</span>
```
> t
# => "Tasha"
> x + y
# => 8
> vaidehi + " & " + t
# => "Vaidehi & Tasha"
```
</script>
</section>
<section data-markdown>
<script type="text/template">
## Use a variable to make your program run
### <span class="fragment">Try to do it in as few lines as possible</span>
#### <span class="fragment">Hint: you'll need to use some tools from last week!</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
##Solutions?
```
susie = "I saw Susie sitting in a shoe shine shop. Where she sits she shines,
and where she shines she sits." + " "
susie * 20
```
<span class="fragment">or</span>
```
susie = "I saw Susie sitting in a shoe shine shop. Where she sits she shines,
and where she shines she sits. "
susie * 20
```
</script>
</section>
<section data-markdown>
<script type="text/template">
## Methods
### <span class="fragment">How we send actions</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
### Everything in Ruby is an object.
</script>
</section>
<section data-markdown>
<script type="text/template">
<img src="assets/objectmethod.png">
</script>
</section>
<section data-markdown>
<script type="text/template">
##What methods have we learned?
###<span class="fragment">`+ = - / * %`</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
##Some *really* useful methods
- <span class="fragment">`puts (implicit reciever for self)`</span>
- <span class="fragment">`gets`</span>
- <span class="fragment">`gets.chomp`</span>
- <span class="fragment">`.to_i`</span>
- <span class="fragment">`.length`</span>
- <span class="fragment">`.reverse`</span>
- <span class="fragment">`.upcase`</span>
- <span class="fragment">`.downcase`</span>
- <span class="fragment">`.capitalize`</span>
- <span class="fragment">`.swapcase`</span>
- also:
- <span class="fragment">`rand`</span>
- <span class="fragment">`.to_s`</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
##Lets write a program.
###<span class="fragment">Create a new file and add this:</span>
```
puts "Tell me your name!"
name = gets
name
```
</script>
</section>
<section data-markdown>
<script type="text/template">
##Cool - now run your program.
</script>
</section>
<section data-markdown>
<script type="text/template">
## Name transformer machine
- Write a program that uses each of the String methods we just learned.
- Your program will be a machine that takes an input (your name) and transforms it using a method
```ruby
puts "tell me your name!"
name = gets
puts "Your name in upcase: " + name.upcase
```
- Part 2 of this assignment: Number transformer machine (use the docs!)
</script>
</section>
<section data-markdown>
<script type="text/template">
##Now for some social networking/version control.
###<span class="fragment"><a href="https://github.com/">GitHub</a></span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## Homework:
- <span class="fragment">Create GitHub account</span>
- <span class="fragment">https://github.com/latazzajones/Intro-to-Programming-Using-Ruby/wiki/Exercises</span>
</script>
</section>
<!-- DAY 3 -->
<section>
<h2>Day 3</h2>
</section>
<section data-markdown>
<script type="text/template">
## Some Things From Last Week...
- <span class="fragment">Method Chaining: `"ruby".upcase.reverse.swapcase`</span>
- <span class="fragment">`pwd`: "print working directory" (*not* "present working directory"!!)</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## Review the Homework!
- <span class="fragment">How did you write the `full name greeting` program?</span>
- <span class="fragment">There's more than one way to do something!</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## Time to git our git on
- <span class="fragment">Version control</span>
- <span class="fragment">Locally-hidden files prepended with `.git`</span>
- <span class="fragment">Do you have git? (`git --version`)
* Install from <a href="http://git-scm.com/book/en/v2/Getting-Started-Installing-Git">here</a>.
</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## Using git locally
- <span class="fragment">`git init`</span>
- <span class="fragment">`git status`</span>
- <span class="fragment">`git add --all`</span>
- <span class="fragment">`git commit -m`</span>
- <span class="fragment">`git branch`</span>
- <span class="fragment">`git log`</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## Making our first commit
```
git init
git status
git add --all
git commit -m "first commit! yay!"
```
###<span class="fragment">Let's check our log:</span>
```
git log
```
</script>
</section>
<section data-markdown>
<script type="text/template">
##Time to work on `Angry Boss`!!
* Angry boss. Write an angry boss program that rudely asks what
you want. Whatever you answer, the angry boss should yell it
back to you and then fire you. For example, if you type in I want
a raise, it should yell back like this:
`WHADDAYA MEAN "I WANT A RAISE"?!? YOU'RE FIRED!!`
</script>
</section>
<section data-markdown>
<script type="text/template">
## Let's commit `Angry Boss` !
#### <span class="fragment">...do you remember how?</span>
<span class="fragment"><a href="#/52">Here's a hint</a></span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## Flow control
- <span class="fragment">How we handle logic in our code.</span>
- <span class="fragment">**Comparisons** & **conditionals** (aka "branching")</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## Comparisons
#### <span class="fragment">comparing one object to another</span>
- <span class="fragment">`<`</span>
- <span class="fragment">`>`</span>
- <span class="fragment">`>=`</span>
- <span class="fragment">`<=`</span>
- <span class="fragment">`==`</span>
- <span class="fragment">`!=` (not equals to)</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## Nothingness
#### <span class="fragment">Everything in Ruby is an object.</span>
#### <span class="fragment">Objects are inherently "truthy" values, because they exist.</span>
#### <span class="fragment">...but what about the *absence* of an object?</span>
## <span class="fragment">`nil`</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## <span class="fragment">`nil` is nothing<span>
- <span class="fragment">Evaluates to neither `true` nor `false`</span>
- <span class="fragment">Nil is *not* a truthy value -- it's falsey (it doesn't exist)</span>
- <span class="fragment">The **only** other falsey value in Ruby is `false`.</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## Comparisons
### <span class="fragment">let's play in irb:</span>
```
> 1 > 2
# => false
> 1 < 2
# => true
> 'dog' == 'dog'
# => true
> 1 == '1'
# => false
```
</script>
</section>
<section data-markdown>
<script type="text/template">
## What about `true` and `false`?
### <span class="fragment">What are they?</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
##`true` and `false`
### <span class="fragment">are objects & data types!</span>
###<span class="fragment">We call them `booleans`</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## Conditionals
#### <span class="fragment">logical statements based on how comparisons evaluate</span>
- <span class="fragment">`if`</span>
- <span class="fragment">`else`</span>
- <span class="fragment">`elsif`</span>
- <span class="fragment">`end`</span>
- <span class="fragment">`&&`</span>
- <span class="fragment">`||`</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
### Combining conditionals and comparisons (example 1):
```
if "dog".length > 4
puts "Woof woof!"
else
puts "dawg"
end
```
</script>
</section>
<section data-markdown>
<script type="text/template">
### Combining conditionals and comparisons (example 2):
#### <span class="fragment">Using ||</span>
```
cat = 'purrr'
if cat == 'purrr' || cat == 'meow'
puts 'Hi kitty!'
end
```
#### <span class="fragment">Using &&</span>
```
dog = 'woof'
cat = 'purrr'
if cat == 'purrr' && dog == 'woof'
puts 'Too many animals!'
end
```
</script>
</section>
<section data-markdown>
<script type="text/template">
### Combining conditionals and comparisons (example 3):
```
puts 'Hello, what\'s your name?'
name = gets.chomp
puts 'Hello, ' + name + '.'
if name == 'Chris'
puts 'What a lovely name!'
elsif name == 'Katy'
puts 'That\'s a nice name!'
end
```
</script>
</section>
<section data-markdown>
<script type="text/template">
## Hai, I'm a loop!
### <span class="fragment">`while` & `break`</span>
```
while true
puts 'What would you like to ask C to do?'
request = gets.chomp
puts 'You say, "C, please ' + request + '"'
puts 'C\'s response:'
puts '"C ' + request + '."'
puts '"Papa ' + request + ', too."'
puts '"Mama ' + request + ', too."'
puts '"Ruby ' + request + ', too."'
puts '"Nono ' + request + ', too."'
puts '"Emma ' + request + ', too."'
puts
if request == 'stop'
break
end
end
```
</script>
</section>
<section data-markdown>
<script type="text/template">
## Work time!
* <span class="fragment">Start `99 Bottles of Beer` and `Boring Bar Date` https://github.com/latazzajones/Intro-to-Programming-Using-Ruby/wiki/Exercises#day-3 </span>
* <span class="fragment">Save them as separate files in your `/Development` directory and commit your work frequently!</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## Homework
- <span class="fragment">Finish both exercises</span>
- <span class="fragment">Use version control and **commit, commit, commit**!</span>
- <span class="fragment">Check out Ruby Monk over <a href="http://rubymonk.com">here</a>.</span>
</script>
</section>
<!-- DAY 4 -->
<section>
<h2>Day 4</h2>
</section>
<section data-markdown>
<script type="text/template">
## Homework Review
- <span class="fragment">Time to push what we committed last week!</span>
- <span class="fragment">We'll set up a new repository together!</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## Making a new repo on GitHub
- <span class="fragment">Go to your GitHub account</span>
- <span class="fragment">Click on the `Repositories` tab</span>
- <span class="fragment">Click the `new` button
- <span class="fragment">Name your repository -- generally the same name as the directory that has your files.</span>
- <span class="fragment">Follow the instructions to create a new repository from the command line.</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
## `git push origin master`
</script>
</section>
<section data-markdown>
<script type="text/template">
## What happened on GitHub?
</script>
</section>
<section data-markdown>
<script type="text/template">
##You're watching the world cup!
<img src="http://img1.nymag.com/imgs/daily/intelligencer/2014/07/13/celebration-on-offsides-goal.w529.h352.2x.gif">
</script>
</section>
<section data-markdown>
<script type="text/template">
##How can you store a list of the winning teams?
</script>
</section>
<section data-markdown>
<script type="text/template">
###What if there was a way to keep a bunch of objects together in the same place?
</script>
</section>
<section data-markdown>
<script type="text/template">
#ARRAYS
</script>
</section>
<section data-markdown>
<script type="text/template">
##An array
###<span class="fragment">is a way of storing a list of objects in a particular order.</span>
<span class="fragment">`['Germany', 'Argentina', 'Belgium', 'Colombia']`</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
##An array
* <span class="fragment">is a data structure.</span>
* <span class="fragment">You can assign it to a variable.</span>
```
bmore_brewers = ['Public Works', 'Union Brewery', 'Brewers Art']
```
</script>
</section>
<section data-markdown>
<script type="text/template">
###You can put ANY object into an array.
```
random_array = [0.3, "Q", 7, "cats are cute but annoying"]
any_data_structure = [2, [], "hot sauce!", [1, 2, 3]]
nothing_is_something = [nil, nil]
```
<span class="fragment">(Data structures are objects, too!)</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
##Order matters
* <span class="fragment">Every object in an array has a location</span>
* <span class="fragment">We call an object's location in an array its **index**</span>
* <span class="fragment">An object knows its index</span>
* <span class="fragment">An index knows which object is located there.</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
<img src="assets/array.png">
<span class="fragment">Ruby arrays are zero indexed!</span>
</script>
</section>
<section data-markdown>
<script type="text/template">
##Using the index
```
random_array = [0.3, "Q", 7, "cats are cute but annoying"]
random_array[1]
randome_array.index("cats are cute but annoying")