You have it correct, but looking at the algorithm I think a and b need to be both greater than zero.
As it is with a=0 and b=9
the "while" starts with 0 <> 9
and since "a>b" isn't true with "0>9" then the else is run that subtracts 0 from 9
And it repeats the while. Notice a and b are unchanged for the second iteration so you have an infinite loop.