+ 1
Guys Can Anyone tell me How to use "if"
Guys I was trying to use if but an error eqquried everytime. Help Me
5 Answers
+ 1
post your code
0
hi momi, so tell us in wich language you tried the "if-clause"...
that is not that important, but we will give you the exact example.
0
Csharp
0
int x = 8;
int y = 3;
if (x > y)
//if true code in brackets will print
{
Console.WriteLine("x is greater than y");
//this
}
//if false it will skip that code a do nothing.
0
int x = 0
int y = 1;
//simple if statement
if(x < 1){
System.out.println("hello");
}else{
//else statement is used when the 'if' statement is false
System.out.println("bye");
}
//double if statement
if(x < 2 || y y < 2){
// this || is used to represent 'or'
// this code is specifying that if x or y is less than 2
}
if(x < 2 && y < 2){
// this '&&' used used to represent 'and'
// this code States that both statement need to be true
}