Control flow

Control Flow

If Else

To use conditional statements:

 သည်  ဖြစ်လျှင် () ကို အဖြေထုတ်ပါ။ မဖြစ်ပါက (  ) ကို အဖြေထုတ်ပါ။

Example:

 ( a > b ) သည် ( "a is greater" ) ဖြစ်လျှင် ( "a is greater" ) ကို အဖြေထုတ်ပါ။ မဖြစ်ပါက ( "b is greater" ) ကို အဖြေထုတ်ပါ။

For Loop

To use a for loop:

( variable = start_value ; variable < end_value ; variable = variable + increment ) ( loop_body ) ကို လုပ်ဆောင်ပါ။

Example:

( i = 0 ; i < 10 ; i = i + 1 ) ( "Loop iteration " , i ) ကို လုပ်ဆောင်ပါ။

While Loop

To use a while loop:

( condition ) ဖြစ်နေသမျှ ( loop_body ) ကို လုပ်ဆောင်ပါ။

Example:

 ( a < 10 ) ဖြစ်နေသမျှ ( a ကို အဖြေထုတ်ပါ။ a = a + 1 ) ကို လုပ်ဆောင်ပါ။

Last updated