Results 1 to 2 of 2

Thread: Confusing Error

  1. #1
    CODinacup is offline Member
    Join Date
    Sep 2012
    Rep Power

    Default Confusing Error

    I do not get an error when i comment out the while loop, but as soon as i uncomment it i get an error.

    Java Code:
      public void history2()
    	   Boolean cont;
    	   cont = true;
    	   while( cont == true ){
          int bet = inputInt("Daily Double!"+"\n"+"Please input your bet:");
         if( bet >= score){
           output( "Please input a valid bet." );
           cont = true;    
         else{ cont = false; }
          String guess = inputString("What is my favorite color?");
          if ( 
              guess.equalsIgnoreCase( "red" )
              || guess.equalsIgnoreCase( "blue" ))
             score = score + bet;
             score = score - bet;         
             output("Wrong... Try Again " ); 

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power

    Default Re: Confusing Error

    It usually helps to tell us what the error is so we don't have to guess. Better still, to post the entire error message. Also, please use proper and consistent indentation. It's hard enough trying to understand someone else's code that you shouldn't make it harder with indentation that's randomly placed. Indent each block 3 spaces (no tabs), and all code lines within the same block should begin at the same column.

Similar Threads

  1. A very confusing question
    By JohnPringle83 in forum New To Java
    Replies: 3
    Last Post: 05-08-2011, 08:29 AM
  2. confusing ques
    By rok0016 in forum New To Java
    Replies: 6
    Last Post: 07-15-2010, 07:07 PM
  3. Confusing input question
    By jigglywiggly in forum New To Java
    Replies: 1
    Last Post: 03-13-2009, 05:38 AM
  4. Confusing IndexOutOfBounds Error?
    By tibbyuk in forum New To Java
    Replies: 2
    Last Post: 08-09-2008, 12:42 AM
  5. Confusing with Frameworks
    By hisouka in forum New To Java
    Replies: 0
    Last Post: 08-05-2008, 06:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts