I'd also recommend `:degree <= 0` as the check, rather than `= 0`, just in case someone passes `5.01` to the function (which would cause an infinite loop as you'd never hit exactly 0). But yes, if that was just coded into the comment box then it looks pretty good.
Comments
I'd also recommend `:degree <= 0` as the check, rather than `= 0`, just in case someone passes `5.01` to the function (which would cause an infinite loop as you'd never hit exactly 0). But yes, if that was just coded into the comment box then it looks pretty good.