回答編集履歴

1

ちょい修正

2018/10/08 22:59

投稿

asm
asm

スコア15149

test CHANGED
@@ -12,31 +12,33 @@
12
12
 
13
13
  def [](num)
14
14
 
15
- if num % 15 == 0
15
+ ans = case 0
16
16
 
17
- ans = "FizzBuzz"
17
+ when num % 15
18
18
 
19
- @fizzbuzz.push(num)
19
+ @fizzbuzz.push(num)
20
20
 
21
- elsif num % 3 == 0
21
+ "FizzBuzz"
22
22
 
23
- ans = "Fizz"
23
+ when num % 3
24
24
 
25
- @fizz.push(num)
25
+ @fizz.push(num)
26
26
 
27
- elsif num % 5 == 0
27
+ "Fizz"
28
28
 
29
- ans = "Buzz"
29
+ when num % 5
30
30
 
31
- @buzz.push(num)
31
+ @buzz.push(num)
32
32
 
33
- else
33
+ "Buzz"
34
34
 
35
- ans = "Normal"
35
+ else
36
36
 
37
- @normal.push(num)
37
+ @normal.push(num)
38
38
 
39
+ "Normal"
40
+
39
- end
41
+ end
40
42
 
41
43
  puts "#{num} >> #{ans}"
42
44