Skip to content

Commit 4692141

Browse files
Merge pull request #397 from koddsson/patch-2
Remove bonus section in Ruby Lesson 2, Exercise 1
2 parents f926667 + 70b8974 commit 4692141

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

ruby/lesson2/tutorial.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -130,22 +130,6 @@ puts "Total time #{duration} seconds"
130130
puts "#{duration/turns} seconds per problem"
131131
```
132132

133-
### Bonus
134-
135-
At the beginning of the game ask for the number of turns. If return is pressed default to 0.
136-
137-
> To default value of a variable, only if the variable empty you can use the `||=` operant. This is called lazy loading.
138-
139-
```ruby
140-
# here the number will get assigned to 1 as its value is nil
141-
number = nil
142-
number ||= 1
143-
144-
# The number will not get assigned to 1 because it already has a value
145-
number = 2
146-
number ||= 1
147-
```
148-
149133
## Reading and writing to a file
150134

151135
In Ruby we can use the `File` object to read and write to files.

0 commit comments

Comments
 (0)