title: Comparing strings using the 'compare' function
body: <p>To compare two strings and add the string to a list if they're equal, I created this function using the built-in compare function:</p>
  
  <pre><code>fun compareString(string, list) = 
      if compare(string, "hello") = EQUAL then string::list;
  </code></pre>
  
  <p>However, this gives an error. I guess my syntax must be wrong, did I use the compare function correctly? </p>
  
  <p>According to the documentation, the compare function works as follows:</p>
  
  <blockquote>
    <p><em>compare (s, t) does a lexicographic comparison of the two strings using the ordering <code>Char.compare</code> on the characters. It returns <code>LESS</code>, <code>EQUAL</code>, or <code>GREATER</code>, if s is less than, equal to, or greater than t, respectively.</em></p>
  </blockquote>