From 9d042a00b639df6ac00606903611b3cd6c30efd0 Mon Sep 17 00:00:00 2001 From: Carl Date: Sat, 14 Oct 2023 22:52:13 +0200 Subject: [PATCH] Simplify example --- exercises/practice/collatz-conjecture/.meta/src/example.cr | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/practice/collatz-conjecture/.meta/src/example.cr b/exercises/practice/collatz-conjecture/.meta/src/example.cr index 53a0f1cb..6084941a 100644 --- a/exercises/practice/collatz-conjecture/.meta/src/example.cr +++ b/exercises/practice/collatz-conjecture/.meta/src/example.cr @@ -7,13 +7,13 @@ module CollatzConjecture n = input steps = 0 until n == 1 - if n % 2 == 0 - n = n / 2 + if n.divisible_by?(2) + n /= 2 else n = 3 * n + 1 end - steps = steps + 1 + steps += steps end steps