Applescript 简单脚本未按预期工作

Applescript 简单脚本未按预期工作,applescript,Applescript,我制作了一个简单的脚本应用程序,它接受用户输入的半径,并根据输入计算和显示圆的面积: -- initializing radius variable to some text set radius to "Some text" repeat until class of radius is number -- asking user for radius display dialog "Enter radius: " default answer "" buttons {"Done"} de

我制作了一个简单的脚本应用程序,它接受用户输入的半径,并根据输入计算和显示圆的面积:

-- initializing radius variable to some text
set radius to "Some text"

repeat until class of radius is number

-- asking user for radius
display dialog "Enter radius: " default answer "" buttons {"Done"} default button 1
set userInput to text returned of result

-- try to check if user enters radius as number
try

-- converting input from user to number 
set radius to userInput as number

-- if input is found as number then below code is executed
-- obtaining radius from handler
set circleArea to calculateCircleArea(radius)

-- displaying radius and area of circle obtained to user
display dialog "Circle area for radius: " & radius & " is: " & circleArea buttons {"OK"} default button 1
end try
end repeat

-- handler definition
on calculateCircleArea(parameterRadius)
set areaOfCircle to pi * (parameterRadius ^ 2)
end calculateCircleArea
当我第一次执行上面的脚本并输入一些文本时,它再次要求我输入半径,这次我输入了一些数字,它显示了圆的区域,但它再次开始要求用户输入半径

有人能告诉我上面的剧本哪里错了吗

谢谢

米拉伊

repeat until class of radius is integer or class of radius is real