From 17a8393a83e3c40f44bba854e2cf85701d95dfcb Mon Sep 17 00:00:00 2001 From: Jack Thorne Date: Sat, 6 Jan 2024 01:25:09 -0600 Subject: [PATCH 1/2] add docs for Int#downto --- src/int.cr | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/int.cr b/src/int.cr index 6f0d3aa5881a..78ed29248aa4 100644 --- a/src/int.cr +++ b/src/int.cr @@ -574,6 +574,21 @@ 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 From 690f7bb1b47e643158f586dd5911464f24f928bf Mon Sep 17 00:00:00 2001 From: Jack Date: Sat, 6 Jan 2024 13:31:32 -0600 Subject: [PATCH 2/2] Update src/int.cr Co-authored-by: George Dietrich --- src/int.cr | 1 - 1 file changed, 1 deletion(-) diff --git a/src/int.cr b/src/int.cr index 78ed29248aa4..73859919c2aa 100644 --- a/src/int.cr +++ b/src/int.cr @@ -588,7 +588,6 @@ struct Int # 2 # 1 # ``` - def downto(to, &block : self ->) : Nil return unless self >= to x = self