File tree 2 files changed +32
-0
lines changed
2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -17,4 +17,8 @@ A module is a collection of constants and methods. Enumerable has methods used f
17
17
A class can only inherit from one parent class, but by using Mixin Modules you can simulate multiple inheritance.
18
18
19
19
5. What is the difference between a Module and a Class?
20
+ <<<<<<< HEAD
20
21
Modules you can use across multiple classes. Modules are about functions and constants and classes are about objects and instances.
22
+ =======
23
+ Modules you can use across multiple classes. Modules are about functions and constants and classes are about objects and instances.
24
+ >>>>>>> 500e6f9d77bbce46d757bf3757289e7e5b1b69ae
Original file line number Diff line number Diff line change
1
+ class SimonSays
2
+ def echo answer
3
+ puts answer
4
+ end
5
+ def shout phrase
6
+ puts phrase . upcase
7
+ end
8
+ def repeat ( text , num )
9
+ if num == nil
10
+ num = 1
11
+ num . times do
12
+ puts text
13
+ end
14
+ else
15
+ num . times do
16
+ puts text
17
+ end
18
+ end
19
+ end
20
+ def start_of_word ( text , num )
21
+ index = num - 1
22
+ puts text [ 0 ..index ]
23
+
24
+ end
25
+ def first_word ( text )
26
+ puts text . split ( ' ' ) . first
27
+ end
28
+ end
You can’t perform that action at this time.
0 commit comments