• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question


  • Subject: Re: Question
  • From: Michelle Steiner <email@hidden>
  • Date: Sun, 3 Dec 2000 17:56:12 -0800

On 12/3/00 5:44 PM, Jolly Roger <email@hidden> wrote:

>I'm not clear on what you are asking...
>
>Your script always executes the else clause, because the if test always
>fails. Is that the "unforeseen side effect" you are referring to? I
>wouldn't call it a side effect. The script operating as it should.
>myButton never equals "compute circumference".

whoops; I made a typo. I had "diameter" instead of "circumferance" in
all places, and then I replaced them, but forgot to replace it in the
button name. I made those changes *after* I found the unforseen side
effect, and didn't test it again after making those changes. <sigh>

Here's the corrected script.

set invalid to "What the????"

display dialog "enter the radius" default answer ,
"" buttons {"Compute cirumference", " Compute area"}
set {myAnswer, myButton} to ,
{text returned, button returned} of the result

try
if myAnswer as number is greater than 0 then
if myButton is "compute cirumference" then
my displaydialog("cirumference", myAnswer * 2 * pi)
else
my displaydialog("area", myAnswer ^ 2 * pi)
end if
else
display dialog invalid
end if
on error
display dialog invalid
end try

on displaydialog(inputString, theNumber)
display dialog "The " & inputString & " is " & ,
theNumber buttons {"Yeah man"}
end displaydialog

----------------------------------------------------------------------
| Michelle Steiner | Hard as it may be to believe, my |
| email@hidden | life has been based on a true story. |
----------------------------------------------------------------------


  • Follow-Ups:
    • Re: Question
      • From: Chris Nebel <email@hidden>
    • Re: Question
      • From: Jolly Roger <email@hidden>
  • Prev by Date: Re: Question
  • Next by Date: Re: Question
  • Previous by thread: Re: Question
  • Next by thread: Re: Question
  • Index(es):
    • Date
    • Thread