Sha256: 57879e78564e6b7d0c9d05fa8761d05d1e4486a577e411fd3d7f599a39c93f50

Contents?: true

Size: 538 Bytes

Versions: 39

Compression:

Stored size: 538 Bytes

Contents

配列全体を表示してから、配列の要素を順に表示するプログラムを作成せよ。
ただし、配列はプログラム内で定義すること。


- eachメソッド

配列名.each do |変数|
  繰り返したい処理(|変数|で指定された変数を含む)
end

eachメソッドは、配列の要素すべてにアクセスする必要がある際に用いられる。
配列から要素を1つずつ取り出して、|変数|で指定された変数に代入して処理を繰り返し実行する。

Version data entries

39 entries across 24 versions & 1 rubygems

Version Path
ruby_learner-1.2.9 contents/takahashi/sample_prog/question/6_4.org
ruby_learner-1.2.8 contents/takahashi/sample_prog/question/6_4.org
ruby_learner-1.2.7 contents/takahashi/sample_prog/question/6_4.org
ruby_learner-1.2.6 contents/takahashi/sample_prog/question/6_4.org
ruby_learner-1.2.5 contents/takahashi/sample_prog/question/6_4.org
ruby_learner-1.2.4 contents/takahashi/sample_prog/question/6_4.org
ruby_learner-1.2.3 contents/takahashi/sample_prog/question/6_4.org
ruby_learner-1.2.2 contents/takahashi/sample_prog/question/6_4.org
ruby_learner-1.2.1 contents/takahashi/sample_prog/question/6_4.org
ruby_learner-1.2.0 contents/takahashi/sample_prog/question/6_4.org
ruby_learner-1.2.0 contents/questions/sequential_check/section_6/part_4/lib/sentence.org
ruby_learner-1.1.15 takahashi/sample_prog/question/6_4.org
ruby_learner-1.1.15 questions/sequential_check/section_6/part_4/lib/sentence.org
ruby_learner-1.1.14 takahashi/sample_prog/question/6_4.org
ruby_learner-1.1.14 questions/sequential_check/section_6/part_4/lib/sentence.org
ruby_learner-1.1.13 questions/sequential_check/section_6/part_4/lib/sentence.org
ruby_learner-1.1.13 takahashi/sample_prog/question/6_4.org
ruby_learner-1.1.11 takahashi/sample_prog/question/6_4.org
ruby_learner-1.1.11 questions/sequential_check/section_6/part_4/lib/sentence.org
ruby_learner-1.1.10 questions/sequential_check/section_6/part_4/lib/sentence.org