Sha256: 6517f9bca7966c81072c818d1d4bcec000c6e3416dacf1e3a4553d60e0efe470

Contents?: true

Size: 468 Bytes

Versions: 35

Compression:

Stored size: 468 Bytes

Contents

コマンドラインから2つの引数を受け取って数値に変換し、その和、差、積、商を表示するプログラムを作成せよ。


- 変数

変数名 = オブジェクト


- .to_i

変数名 = オブジェクト.to_i

オブジェクトの直後に記述することで、そのオブジェクトを数値に変換する。
ARGVは引数を文字列として受け取るため、そのままでは計算には使えないことに注意。

Version data entries

35 entries across 24 versions & 1 rubygems

Version Path
ruby_learner-1.1.8 takahashi/sample_prog/question/2_2.org
ruby_learner-1.1.7 questions/sequential_check/section_2/part_2/lib/sentence.org
ruby_learner-1.1.7 takahashi/sample_prog/question/2_2.org
ruby_learner-1.1.6 takahashi/sample_prog/question/2_2.org
ruby_learner-1.1.6 questions/sequential_check/section_2/part_2/lib/sentence.org
ruby_learner-1.1.5 takahashi/sample_prog/question/2_2.org
ruby_learner-1.1.5 questions/sequential_check/section_2/part_2/lib/sentence.org
ruby_learner-1.1.4 takahashi/sample_prog/question/2_2.org
ruby_learner-1.1.4 questions/sequential_check/section_2/part_2/lib/sentence.org
ruby_learner-1.1.3 takahashi/sample_prog/question/2_2.org
ruby_learner-1.1.3 questions/sequential_check/section_2/part_2/lib/sentence.org
ruby_learner-1.1.2 questions/sequential_check/section_2/part_2/lib/sentence.org
ruby_learner-1.1.2 takahashi/sample_prog/question/2_2.org
ruby_learner-1.1.1 takahashi/sample_prog/question/2_2.org
ruby_learner-1.1.1 questions/sequential_check/section_2/part_2/lib/sentence.org