Use integer#upto instead of for