on mouseUp ask "Number1:" put it into num1 ask "Number2:" put it into num2 put "gcd(" & num1 & ", " & num2 & ") = " & gcd(num1 &","& num2) end mouseUp function gcd params put item 1 of params into num1 put item 2 of params into num2 if (num1 > num2) then put num1 into temp put num2 into num1 put temp into num1 end if repeat forever put num2 - num1 * trunc(num2/num1) into num2 if (num2 is 0) then put num1 into gcd return gcd end if put num1 - num2 * trunc(num1/num2) into num1 if (num1 is 0) then put num2 into gcd return gcd end if end repeat end gcd