title: Why isn't the Boolean value recognized?
body: <pre><code>public class HelloWorld {
  
      public static void main(string[] args) {
          boolean found;
          String[] caseArray = new caseArray {
              &quot;apple&quot;, &quot;orange&quot;, &quot;mango&quot;, &quot;pineapple&quot;
          } ;
          for (int i = 0; i &lt; caseArray.length; i++) {
              if (caseArray[i].equals(&quot;pineapple&quot;)) {
                  found = true;
                  break;
              } else {
                  found = false;
              }
          }
          if (found == true) {
              System.out.println(&quot;product found&quot;);
              break;
          } else {
              System.out.print(&quot;product not found&quot;);
              break;
          }
      }
  }
  </code></pre>
  <p>In the above code I would like to return found = true when the for loop searches pineapple in the array. If found is equal to true I would like it to print &quot;product found&quot;, if found = false I would like it to print &quot;product not found&quot;.</p>