diff --git a/src/int.cr b/src/int.cr index 6f0d3aa5881a..73859919c2aa 100644 --- a/src/int.cr +++ b/src/int.cr @@ -574,6 +574,20 @@ struct Int end # Calls the given block with each integer value from self down to `to`. + # + # ``` + # 3.downto(1) do |i| + # puts i + # end + # ``` + # + # Prints: + # + # ```text + # 3 + # 2 + # 1 + # ``` def downto(to, &block : self ->) : Nil return unless self >= to x = self