I can't figure out where I messed up the for loop and why the first If isn't highlighted

Viewed 14

I can't figure out where I messed up my code on this project. Something is wrong with the loop. Could someone help me understand where I messed up

    for(int i=0;i<50;i++);
    
    System.out.println("WELCOME TO STATE CAPITAL GAME");

     System.out.println ("What is the state capital of+Capital[i][0]?");
     Capital = input.nextLine();
    
    if(Capital.equalsIgnoreCase(Capital1[i][1]))
     System.out.println("Your answer is correct");
     count = count +1;
     total = total +1;
     
     else if(Capital.equalsIgnoreCase("exits");
        
      System.out.println("Exiting Capital");
      System.out.println("The correct count is +count");
      System.out.println("Total Questions attempted:+total");
      System.out.println("Final result: +count/+total");
      return;
      
      else
    
      System.out.println("The correct answer should be +Capital[i][1]");
      total = total+1;
      
      System.out.println("The correct count is +count");
      System.out.println("You have attempted all 50 questions");
      System.out.println("Final result:+count/+total");
1 Answers

I believe it's that you have a semi colon at the end of the line where your for loop is defined. You want to have an open brace ({) and then a close brace down the line (}).

Related