Input validation confusion!

h inside the unless block cannot modify the value outside, remember that everything is immutable, you could do:

h = case h < base do
 true -> base - 1
 false -> ^h
end

and rebind the value of h in the “upper” scope