From bcd2fe8e555ce84e0d957e860d8f7cc216a39c5c Mon Sep 17 00:00:00 2001 From: James Smith Date: Wed, 15 Jun 2022 07:50:23 +0100 Subject: Y.O.D.A Yoda --- challenge-169/james-smith/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/challenge-169/james-smith/README.md b/challenge-169/james-smith/README.md index e51614d1ea..3e9971e507 100644 --- a/challenge-169/james-smith/README.md +++ b/challenge-169/james-smith/README.md @@ -40,6 +40,8 @@ The output in each row is the brilliant number and the two primes which are it's **Note:** Both in this and the next challenge we utilise a classic "c-style" `for`-loop. This construct allows us to combine the variable initialized (and declaration), the end condition, and the increment of the number into a single statement. We code rewrite this a postfix `for(each)` in this case, but would need an declaration/initialisation statement for `$n` and `@f` anyway. Also in challenge 2 it isn't possible to use a postfix for `for` as this doesn't allow us to use the `next` trick to short cut the `grep` inside the `gcd` call. +**Note:** to make the code easier to read we use a *Yoda* condition, where we reverse the value and the code evaluation - so instead if say `$a == 2` we say `2 == $a`. + **Moan:** Why is there no `sayf` function similar to `printf` - using `say sprintf` seems a bit "messy" each time... ``` -- cgit