Error when assigning booleans
I started learning Java here yesterday, and I wanted to try to make FizzBuzz in java (https://www.youtube.com/watch?v=QPZ0pIK_wsc). When I assign a boolean and then test it things seem to go fine, but whenever I assign a boolean if another condition is true/false, I get the errors 'cannot find symbol' and 'illegal start of type' for every time I check if the boolean is true. This is my code: class SomeClass { public static void main(String[ ] args) { for (int i = 1; i <= 100; i++){ if (i % 3 == 0){ boolean multOfThree = true; } else{ boolean multOfThree = false; } if (i % 5 == 0){ boolean multOfFive = true; } else{ boolean multOfFive = false; } if (multOfThree){ if (multOfFive){ System.out.println("FizzBuzz"); } else{ System.out.println("Fizz"); } } else{ if (multOfFive){ System.out.println("Buzz"); } else{ System.out.println(i); } } } } }