wiki/structured/assets/challenges.exercism.bash/raindrops-improved.sh
Gabriel Arazas 377850d0d1 Update notebook and clean up the folder
I also forget to add the additional solutions from the Exercism
exercises. Whoops...

I'm also getting used to storing code in random places. Time to change
that habit a little bit by storing them in my notebook, instead.
Nothing wrong with that, yeah?!
2021-06-25 13:30:07 +08:00

15 lines
240 B
Bash
Executable File

#/usr/bin/env bash
n=$1
valid=0
function is_factor {
local factor=$1 msg=$2
(( n % factor == 0 )) && printf $msg && valid=1
}
is_factor 3 "Pling"
is_factor 5 "Plang"
is_factor 7 "Plong"
(( valid == 0 )) && echo $n || printf '\n'