title: How do I fix an undefined variable in my program?
body: <p>I am a beginner when it comes to AppleScript. I'm trying to develop a program that can generate an actually random number. When I set the values of the numbers that will be used to generate the random number, the editor gives me an error: </p>
  
  <blockquote>
    <p>The variable numberOne is not defined.</p>
  </blockquote>
  
  <p>I know what this means, but I don't know why it isn't defined. Can someone help with this?</p>
  
  <p>I've tried seeing if only strings would work instead of text, but that doesn't seem to do it. There could be a really easy fix to this, but as I said, I'm a beginner.</p>
  
  <pre><code>on variableValue()
      set numberOne to text returned of (display dialog "Variable One:" default answer "" with icon note buttons {"Cancel", "Continue"} default button 2 with title "Random Number Generator 3") as string
      set numberTwo to text returned of (display dialog "Variable Two:" default answer "" with icon note buttons {"Cancel", "Continue"} default button 2 with title "Random Number Generator 3") as string
      set numberThree to text returned of (display dialog "Variable Three:" default answer "" with icon note buttons {"Cancel", "Continue"} default button 2 with title "Random Number Generator 3") as string
      set numberFour to text returned of (display dialog "Variable Four:" default answer "" with icon note buttons {"Cancel", "Continue"} default button 2 with title "Random Number Generator 3") as string
      set numberFive to text returned of (display dialog "Variable Five:" default answer "" with icon note buttons {"Cancel", "Continue"} default button 2 with title "Random Number Generator 3") as string
      set useSameValues to button returned of (display alert "Use same values?" message "If you re-generate a new number, do you want to use the same values?" as critical buttons {"Cancel", "No", "Yes"} default button 3)
      if useSameValues = "No" then
          set useSameValuesTwo to "false"
      else if useSameValues = "Yes" then
          set useSameValuesTwo to "true"
      end if
  end variableValue
  variableValue()
  on randomNumber()
      -- The line of code just beneath this text is where the error shows up (This is my first program that utilizes handlers, so something could be wrong there).
      set numberSix to (numberOne + numberTwo + numberThree + numberFour + numberFive)
      set numberSeven to (numberSix * (random number from 1 to (random number from 2 to 100)))
      set possibleValueOne to (random number from 1 to 5)
      if possibleValueOne = 1 then
          set numberEight to (numberSeven - numberOne)
      else if possibleValueOne = 2 then
          set numberEight to (numberSeven - numberTwo)
      else if possibleValueOne = 3 then
          set numberEight to (numberSeven - numberThree)
      else if possibleValueOne = 4 then
          set numberEight to (numberSeven - numberFour)
      else if possibleValueOne = 5 then
          set numberEight to (numberSeven - numberFive)
      end if
      set numberNine to (numberEight - 100000)
  end randomNumber
  randomNumber()
  </code></pre>