Conditionals
This topic describes the if statement. The if statement is used to write pieces of code that should 
only be executed under certain circumstances (conditions). Here is an example:
if 
a > 
3
  
b = 
2
else
  
b = 
1
  
a = 
2
endif
In this code snippet, b is given the value 2 when a is greater than 3, otherwise b is given the value 
1, and a is given the value 2. 
Here is the complete syntax of the if statement:
if 
  
[
elseif 
  ]
[
else
  
]
endif
The parts between brackets [ ] are optional. There can be as many elseif blocks as you find useful. 
Here is an example which finds the largest of three variables a, b and c and places it in x:
if 
a > b && a > c
  x = a
elseif 
b > c
  x = b
else
  
x = c
endif
The usage of elseif is not really necessary. The following example does exactly the same thing:
if 
a > b && a > c
  x = a
else
  if 
b > c
    x = b
  
else
    
x = c
  
endif
endif
278






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

web hosting biz

 

Our partners: PHP: Hypertext Preprocessor Cheap Web Hosting JSP Web Hosting Ontario Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Java Hosting Cheapest Hosting

Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved