IF Statement and Logical & Relational Operators

OliverE

Power member.
Reputation
0
IF Statement and Logical & Relational Operators

The IF statement will be very common in your coding future. It is used in practically every coding language there is and its great to get your code to do some decsision making for you.

The statement does vary between some languages (VB for example) so your going to have to learn a few tiny things.


Relational Operators
  • < - Less Than
  • > - Greater Than
  • <= - Less Than or Equal to
  • >= - Greater Than or Equal to
  • == - Equal to
  • != Not Equal to

Logical Operators
  • && - And
  • || - OR
  • ! - Not


IF Statement
Here is an example of an IF Statement. Try and apply it to something in a custom project by yourself.
[java]int x = 5;
int y = 8
if(x<2 && y>5)
System.out.println("Yes");
else;
System.out.println("No");[/java]

Let me know if you need anything :)
 
RE: IF Statement and Locial & Relational Operators

Pretty similar to PHP.

Thanks for the tut mate.
 
Back
Top