This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def fib_iterative(n) | |
| fib_counts = [0, 1] | |
| (n-1).times do | |
| fib_counts << fib_counts[-1] + fib_counts[-2] | |
| end | |
| return fib_counts.last | |
| end | |
| fib_iterative(5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Racer | |
| #===== | |
| def roll_dice | |
| dice = rand(6) + 1 | |
| end | |
| def track | |
| track_a = Array.new(25) { "" } | |
| track_b = Array.new(25) { "" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CTR B | |
| CTR T to open a new tab in the terminal | |
| CTR A to select all | |
| CTR { or } |