चक्रम् (for loop)

transliteration: chakram, meaning: round-loop

चक्रम् loops are a great way to run code a certain or changing amount of ways in a concise manner. चक्रम् takes in 3 parameters initial value, and condition, and a step size.

For example, here is a for loop that वद all of the numbers ० to ९

# This will print ० to ९
चक्र(मान अ = ०; अ < १०; अ = अ+ १)
{
  # चक्रम् takes in 3 parameters initial value, and condition, and a step size
  वद("अ =",अ);
}  

This ends up outputting

= ०
अ = १
अ = २
अ = ३
अ = ४
अ = ५
अ = ६
अ = ७
अ = ८
अ =

Viram:

you can stop the चक्रम् loop between the process by using the

विराम (transliteration: virAm, meaning: stop) keyword:

# This will print only till ५, it will break after अ = ५
चक्र(मान अ = ०; अ < १०; अ = अ+ १){
    यदि (अ >= ५){
        विराम;  # viram is like continue
    }
    वद("अ =>",अ);    
} 

output

= ०
अ = १
अ = २
अ = ३
अ =

Agrim:

you can skip the चक्रम् loop between the process by using the

विराम (transliteration: AgrIm, meaning: skip) keyword:

# This will print only till ५, it will skip after अ = २
चक्र(मान अ = ०; अ < ५; अ = अ+ १){
    यदि (अ == २){
        अग्रिम; # Agrim is like skip
    }
    वद("अ =>",अ);
} 

output

= ०
अ = १
अ = ३
अ =