 
      
      Dinfio Documentation
There are three types of control flow in Dinfio: Conditional if, loop for, and loop while.
  
  
if is used to execute different block of statements based on certain conditions.for is used to execute block of statements repeately with a specified number of times.while is used to execute block of statements again and again as long as the condition is true.ifPattern 1:
if condition
    ' Statements to be executed if condition is true
endifExample:
score = 90
 
if score >= 80
    writeln("Your grade is A")
endif
 
' Output: Your grade is APattern 2:
if condition
    ' Statements to be executed if condition is true
else
    ' Statements to be executed if condition is false
endifExample:
a = 45
 
if a >= 50
    writeln("Passed")
else
    writeln("Didn't pass")
endif
 
' Output: Didn't passPattern 3:
if condition_1
    ' Statements to be executed if condition_1 is true
elseif condition_2
    ' Statements to be executed if condition_1 is false and condition_2 is true
endifPattern 4:
if condition_1
    ' Statements to be executed if condition_1 is true
elseif condition_2
    ' Statements to be executed if condition_1 is false and condition_2 is true
else
    ' Statements to be executed if all conditions are false
endifExample:
score = 70
 
if score >= 80
    writeln("Grade is A")
elseif score >= 70
    writeln("Grade is B")
elseif score >= 60
    writeln("Grade is C")
else
    writeln("Grade is D")
endif
 
' Output: Grade is BforPattern:
for counter, start, end, [step]
    ' Statements
endforcounter is control variable for the loop,
  start is the initial value of counter,
  end is the final value of counter,
  and step is the amount by which counter is incremented each time through the loop. step is optional, default value is 1.
Example:
  
  
for i, 1, 5
    writeln(i)
endforOutput:
1
2
3
4
5Another example:
for i, 5, 1, -1
    writeln(i)
endforOutput:
5
4
3
2
1You can stop the loop immediately using keyword break:
  
  
for i, 1, 100
    writeln(i)
 
    if i == 4
        break
    endif
endforOutput:
1
2
3
4whilePattern:
while condition
    ' Statements to be executed again and again as long as condition is true
endwhileExample:
i = 1
 
while i < 5
    writeln(i)
    i += 1
endwhileOutput:
1
2
3
4Just like loop for, you can stop the loop while immediately using keyword break as well:
  
  
i = 1
 
while i < 50
    writeln(i)
 
    if i == 5
        break
    endif
 
    i += 1
endwhileOutput:
1
2
3
4
5| ← Operators | Index | Functions and Classes → | 
    
    Documentation version: 1.0.16. Updated on: 14 July 2025.
Dinfio is designed and written by Muhammad Faruq Nuruddinsyah. Copyright © 2014-2025. All rights reserved.