2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Ruby】名鉄津島線の準急・急行・特急停車駅判定

Posted at

名鉄津島線の急行停車駅判定プログラムを作りました。

# 名鉄津島線の急行停車駅(準急・特急も同じ)駅名表示

tsushima_line_data = ["須ヶ口","甚目寺","七宝","木田","青塚","勝幡","藤浪","津島"]
express_stop_data = ["須ヶ口","甚目寺","木田","勝幡","津島"]
station_num = tsushima_line_data.length
express_stop_num = express_stop_data.length

for i in 0...station_num do
  station_info = tsushima_line_data[i]
  express_stop_flag = express_stop_data.index(station_info)
  # print(express_stop_flag)
  if express_stop_flag == nil then
    puts "#{station_info}駅は急行停車駅ではありません"
  else
    puts "#{station_info}駅は急行停車駅です"
  end
end

結果は次の通りです。

須ヶ口駅は急行停車駅です
甚目寺駅は急行停車駅です
七宝駅は急行停車駅ではありません
木田駅は急行停車駅です
青塚駅は急行停車駅ではありません
勝幡駅は急行停車駅です
藤浪駅は急行停車駅ではありません
津島駅は急行停車駅です
2
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?