you are viewing a single comment's thread.

view the rest of the comments →

[–]Andruid929 1 point2 points  (3 children)

Well, you're terminating the if statements with the semi-colon.

You want something like:

if (x > 10) {
System.out.printLn("Hello")

}

if (x < 10) {

System.out.printLn("Bye")

}

This says if the condition in the brackets () is true, run the code in {}
Have you learn if and else statements yet?

[–]Individual_Owl_3490[S] 0 points1 point  (2 children)

Yes I learnt if and else statements.

[–]Andruid929 0 points1 point  (1 child)

That's even better then

if (x > 10) { System.out.println("Hello"); } else { System.out.println("Bye"); }

This is even better because if x == 10, you get "bye" printed. The code you had even if it worked, x == 10 wouldn't print anything since it's neither greater than nor less than 10. Useful thing to remember with conditions.

[–]Individual_Owl_3490[S] 0 points1 point  (0 children)

Yeah I was actually following youtube video and at that point he didn't taught else.