+ 2
An error told me that i had else without if but i had if and tried 1milliin times again
else without if????????
4 ответов
+ 8
Why were you adding semicolons on every line lol. @Christian's fix will work just fine.
+ 2
Please post your code so it can be reviewed. We can't debug a code we can't see.
+ 1
public class Program
{
public static void main(String[] args) {int age = 12;
double lenght = 1.55;
if(age < 8|| lenght < 1.30){;
System.out.println("Je bent te klein!");}
else if(age < 10 || lenght < 1.45);{
System.out.println("Je vader moet erbij zijn!");}
else if(age < 12 && lenght > 0.0);{
System.out.println("Je mag alleen!");}
}
}
+ 1
your semi colons are what's causing problems. try
{system.out.println("Je bent te Klein!");}
as well as
else if (age < 10 || lenght < 1.45) { //code }
and also try
else if (age < 12 && lenght > 0.0) { //code }
this looks like it's in c# so this should fix your problem. the reason being is that a semi colon says that the instructions end here. so when the compiler moves on to your { //code } section it doesn't know what it belongs to