Skip to main content
Code Review

Return to Revisions

2 of 2
Commonmark migration

all

Your if can become:

if (2..20).all? {|d| x % d == 0}

To avoid repetition.

all returns at the first false so this should be as fast as yours.

Caridorc
  • 28k
  • 7
  • 54
  • 137
default

AltStyle によって変換されたページ (->オリジナル) /