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.1.10 takahashi/sample_prog/question/6_4.org
ruby_learner-1.1.9 questions/sequential_check/section_6/part_4/lib/sentence.org
ruby_learner-1.1.9 takahashi/sample_prog/question/6_4.org
ruby_learner-1.1.8 questions/sequential_check/section_6/part_4/lib/sentence.org
ruby_learner-1.1.8 takahashi/sample_prog/question/6_4.org
ruby_learner-1.1.7 takahashi/sample_prog/question/6_4.org
ruby_learner-1.1.7 questions/sequential_check/section_6/part_4/lib/sentence.org
ruby_learner-1.1.6 takahashi/sample_prog/question/6_4.org
ruby_learner-1.1.6 questions/sequential_check/section_6/part_4/lib/sentence.org
ruby_learner-1.1.5 takahashi/sample_prog/question/6_4.org
ruby_learner-1.1.5 questions/sequential_check/section_6/part_4/lib/sentence.org
ruby_learner-1.1.4 takahashi/sample_prog/question/6_4.org
ruby_learner-1.1.4 questions/sequential_check/section_6/part_4/lib/sentence.org
ruby_learner-1.1.3 takahashi/sample_prog/question/6_4.org
ruby_learner-1.1.3 questions/sequential_check/section_6/part_4/lib/sentence.org
ruby_learner-1.1.2 questions/sequential_check/section_6/part_4/lib/sentence.org
ruby_learner-1.1.2 takahashi/sample_prog/question/6_4.org
ruby_learner-1.1.1 takahashi/sample_prog/question/6_4.org
ruby_learner-1.1.1 questions/sequential_check/section_6/part_4/lib/sentence.org