title: While else statement equivalent for Java?
body: <p>What is the Java equivalent of the while/else in Python? Because it doesn't work in Java. The first chunk was my python code and the second portion is my attempt to translate it into Java. <strong>Edit: tring to replicate while-else</strong></p>
  
  <pre><code>  while temp.frontIsClear():
      if temp.nextToABeeper():
         temp.pickBeeper()
         count += 1
      temp.move()
   else:
      if temp.nextToABeeper():
         temp.pickBeeper()
         count += 1
   print "The count is ", count
  </code></pre>
  
  <p>Java Attempt</p>
  
  <pre><code>  Robot temp = new Robot();
    int count = 0;
    while (temp.frontIsClear())
    {
       if (temp.nextToABeeper())
       {
          temp.pickBeeper();
          count += 1;
       }
       temp.move();
    }
    else
    {
       if (temp.nextToABeeper())
       {
          temp.pickBeeper();
          count += 1;
       }
    }
    print ("The count is ", count);
  </code></pre>