www.lucersoft.com

   
       Home  |   News  |   Downloads  |   Order  |   Contacts

 

 

Main

Home

Site map

Products

LC Backup

LC Copier

HTML Batch Editor

HTML Batch Editor PRO

Tennis 2001

Freeware

Documentation

HTML Batch Editor PRO

LC Basic

Information

Order

Update Policy

Support

Contacts

Links

 
 
 
 

 
 
 
 
 
 
 
 
 

If, Else, Endif

Language reference


Syntax

 

If (condition)
   statement1
Else
   statement2

Endif


Description:

 

Conditionally executes a group of statements, depending on the value of an expression. Condition is an expression that evaluates to either True or False. The condition is usually a comparison, but it can be any expression that evaluates to a numeric value. LC Basic interprets this value as True or False; a zero numeric value is False, and any nonzero numeric value is considered True. If condition is True, LC Basic executes all the statements following the If keyword.

 

Command EndIf is required. Command Else is optional.

 


Examples:

ret = MsgBox ("Pres YES or NO","",MB_YESNO)
If ret = IDYES
  MsgBox "Yes was pressed"
Else
  MsgBox "NO was pressed"
EndIf 

 

In LC Basic a value False is the same as 0 and any other value is equivalent to True:

 

a = 10
If a
 MsgBox "a is True"
EndIf

a = -1
If a
 MsgBox "a is True"
EndIf

See also:

 

AND operator, OR operatorNOT operator


A statements If, Else, EndIf is a part of kernel LC Basic.

 
Last updated: November 2, 2003
Copyright © 2002 Lucersoft

Add to favorites

Back