2008-12-08から1日間の記事一覧
大域脱出としてのgotoはcatch+throwで置き換えるようになっているから。 maxnum = 9 for x in 3..maxnum do catch :not_prime do for y in 2..x - 1 handan = x.modulo(y) if handan == 0 print x puts ":素数ではありません" throw :not_prime end end pr…
大域脱出としてのgotoはcatch+throwで置き換えるようになっているから。 maxnum = 9 for x in 3..maxnum do catch :not_prime do for y in 2..x - 1 handan = x.modulo(y) if handan == 0 print x puts ":素数ではありません" throw :not_prime end end pr…