質問するログイン新規登録

回答編集履歴

1

endが一つ多い。

2016/10/18 10:21

投稿

cameluby
cameluby

スコア891

answer CHANGED
@@ -4,16 +4,15 @@
4
4
 
5
5
  ```ruby
6
6
  str = "Now I need a drink, alcoholic of course, after the heavy lectures involving quantum mechanics."
7
- def cipher(input)
7
+ def cipher(input)
8
- ret = ""
8
+ ret = ""
9
- input.each_char do |char|
9
+ input.each_char do |char|
10
- if char == char.downcase
10
+ if char == char.downcase
11
- ret += chr(219-ord(char))
11
+ ret += chr(219-ord(char))
12
- else
12
+ else
13
- ret += char
13
+ ret += char
14
- end
15
- end
16
14
  end
15
+ end
17
16
  end
18
17
 
19
18
  str = cipher(str)