Sumedh

If Else Conditon syntax in various languages.



PHP

if( $value == "Test" && $value2 >= 5 )
{ statement1 }
elseif ( strcmp( $value,"test2") ==0 )
{ statement2}
else { statement3 }

Not equal != will not work for multiple conditions OR !!.



Perl

if( $value eq "Test" && $value2 >= 5 )
{ statement1 }
elsif ( $val == 0 )
{ statement2}
else { statement3 }



TCL

if { $value == $val2 && $a != 5 } {
statement1
} elseif { $val2 > 50 } {
statement2
}
else { $val3 < 10 } {
statement3 }



Shell Scripting - KSH

if( $value == "Test" && $value2 >= 5 )
{ statement1 }
elseif ( strcmp( $value,"test2") ==0 )
{ statement2}
else { statement3 }



Java Script

if(i == 0)
{ statement 1 }
else if (i ==5) {}
else
{}



SQL

IF ( fcf = 0 && eps = 1 )
THEN
SET eps_cur := eps_prev;
ELSEIF ( fcf = 1 && eps = 0 )
SET flag := 1;
END IF;



JSP

if( $value == "Test" && $value2 >= 5 )
{ statement1 }
else if ( $value == "test2" )
{ statement2}
else { statement3 }



VB.NET 2008

If condition Then
[statements]
Else If condition Then
[statements]
Else
[statements]
End If



Print

Jsp
out.println("Mesage = "+earl+"<br/>");