SHOW:
|
|
- or go back to the newest paste.
1 | def repeat(blah, *num) | |
2 | if num.length > 0 | |
3 | puts num | |
4 | return (blah + " ") * num | |
5 | else | |
6 | puts num | |
7 | return (blah + " " * 2) | |
8 | end | |
9 | - | end |
9 | + | end |
10 | ||
11 | ||
12 | [3] pry(main)> repeat("hohoho", 3) | |
13 | 3 | |
14 | TypeError: can't convert Array into Integer | |
15 | from /home/john/App_Academy/learn_ruby/03_simon_says/simon_says.rb:12:in `*' | |
16 | [4] pry(main)> |