Skip to content
Narta Xaymar Dirks edited this page Oct 27, 2026 · 1 revision

Blitz3DBlitzPlusBlitzBasic

If

If condition Then statement
If condition Then statement Else statement
If condition
statements
ElseIf condition
statements
Else
statements
EndIf

Description

Runs statements only when the condition is true, which means it is not 0. The one-line form runs the statements after Then up to the end of the line. The block form has no Then, may have any number of ElseIf parts and one Else, and ends with EndIf or End If.

Comparisons give 1 for true and 0 for false, and And, Or and Not combine them.

Examples

x = 5
If x > 3 Then Print "big" Else Print "small"

If x < 3
	Print "less than 3"
ElseIf x < 10 And x <> 7
	Print "3 to 9"
Else
	Print "10 or more"
EndIf
big
3 to 9

Related Commands

ElseIf, EndIf, EndSelect, Select

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally