有人能告訴我爲什麼這不起作用嗎?我不能爲了我的生活找出它爲什麼沒有。它編譯得很好,看起來很好,而且這種方法在其他地方都適用於我......真的需要一些幫助,任何人都知道什麼是錯的?從列表中選擇?
set areatype to (choose from list {"Triagles", "Trapeziums"} with prompt "What would you like to calculate the area of?" with title "Area Calculator")
if areatype contains "Triangles" then
set height to text returned of (display dialog "What is the height of the triangle?" with title "Area Calculator" default answer "")
set base to text returned of (display dialog "What is the base of the triangle?" with title "Area Calculator" default answer "")
set area to (height * base)/2
display dialog "Area = " & area & " units squared" with title "Area Calculator" buttons {"Cancel", "Go again"}
else
if areatype contains "Trapezium" then
set base1 to text returned of (display dialog "What is one base of the trapezium?" with title "Area Calculator" default answer "")
set base2 to text returned of (display dialog "What is the other base of the trapezium?" with title "Area Calculator" default answer "")
set area to ((a + b)/2) * h
display dialog "Area = " & area & " units squared" with title "Area Calculator" buttons {"Cancel", "Go again"}
end if
end if
-Thanks
如果您表現出一些努力,這對於這些問題是非常有幫助的。嘗試註釋掉您的整個代碼,然後逐行添加它,然後看看會發生什麼。你應該很快找到你的答案。 – DonielF