回答編集履歴

1

method

2020/06/28 14:50

投稿

tsumugi02
tsumugi02

スコア29

test CHANGED
@@ -8,21 +8,29 @@
8
8
 
9
9
 
10
10
 
11
- loop do
11
+ def get_int
12
12
 
13
- boobs = gets
13
+ loop do
14
14
 
15
+ i = gets
16
+
15
- if (boobs.match(/[0-9]+/).nil?)
17
+ if !i.match(/[0-9]+/).nil?
18
+
19
+ return i.to_i
20
+
21
+ end
16
22
 
17
23
  puts "数値以外は入力しないでね。もう一回入力してね。"
18
24
 
19
- exit(1)
25
+ end
20
26
 
21
- end
27
+ end
22
28
 
23
29
 
24
30
 
31
+ loop do
32
+
25
- boobs = boobs.to_i
33
+ boobs = get_int
26
34
 
27
35
 
28
36