<s>[INST] function gcd(a: number, b: number): number {
  if (b == 0) return a;
  return gcd(b, a % b);
}

function gcd(a: number, b: number): number {
  while (b != 0) {
    var t = b;
    b = a % b;
    a = t;
  }
  return a;
}

Let's compare the two functions that calculate the greatest common divisor of two numbers. They both take two parameters a and b.

The first function uses recursion and the second function uses a loop (while). 

What differences can be found between the two?[/INST]