title: Applescript using if then statements and choose from list
body: <p>I'm working on a course selection script and each person should only be able to select three courses. I am having issues figuring out how to repeat choose from list if the user selects less than or more than three courses, and only proceed if three choices are selected. Converting the choices from the list to string should work however nothing happens after choosing from list</p>
  
  <pre><code>set theClassList to {"Math ", "English ", "Science ", "I&amp;S ", "Design "}
  
  repeat
  
  set theClass to choose from list theClassList with prompt "Select three courses" with multiple selections allowed
  
  set theClassString to theClass as string
  
  if words in theClassString ≠ 3 then
  
      display dialog "Please select three courses"
      exit repeat
  
  else if words in theClassString = 3 then
      display dialog "Ok"
  
  end if
  end repeat
  </code></pre>