title: Methods that return boolean values
body: <p>Okay, so my question is regarding boolean returns. For my Comp Sci homework, I have to make a course registration program using methods, and one of them is an add course method. Basically, you search for the class in a catalog, and if it matches you add it to the students schedule and return a boolean value of true. I did this, but for some reason it is giving me an error. Here is the code:</p>
  
  <pre><code>public static boolean addCourse(
      Course[] catalog,
      Course[] mySchedule,
      int myNumCourses,
      int dept,
      int courseNum)
  {
      int j;
      int i;
      int k;
      int deptCat;
      int courseNumCat;
      Course courseAdd = null;
      char checkDay;
      int checkTime;
  
  
  
      if (mySchedule.length == myNumCourses) {
          return false;
      }
          for (i = 0 ; i &lt; catalog.length ; i++) {
              Course course = catalog[i];
              deptCat = course.getDepartment();
              courseNumCat = course.getCourseNumber();
              if (deptCat == dept &amp;&amp; courseNumCat == courseNum) {
                  courseAdd = catalog[i];
                  break;
              }
              else continue; }
          for (j = 0 ; j &lt; myNumCourses ; j++) {
              if (mySchedule[j] == null) {
                  mySchedule[j] = courseAdd;
                  return true;
                  }
                  else continue;
                  }
  
      for (k = 0 ; k &lt; mySchedule.length ; k++) {
          Course course = mySchedule[k];
          if (course != null) {
              checkDay = course.getDay();
              checkTime = course.getPeriod();
              if (checkDay == courseAdd.getDay() &amp;&amp; checkTime == courseAdd.getPeriod()) {
                  return false;
              }
          }
          else continue;
  
      }
  
  
  
  
  
  
  
  }
  </code></pre>
  
  <p>Why doesn't it recognize the boolean return values? Is it because I placed them inside a loop?</p>