dev-resources.site
for different kinds of informations.
Control Flow Statements ( if, else, else if) in dart (Bangla)
Dart āĻĒā§āĻ°ā§āĻā§āĻ°āĻžāĻŽāĻŋāĻ āĻāĻžāĻˇāĻžāĻ¯āĻŧ Control Flow Statements (āĻ¯ā§āĻŽāĻ¨: if
, else
, else if
) āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ° āĻāĻ°āĻž āĻšāĻ¯āĻŧ āĻā§āĻ¨ā§ āĻ¨āĻŋāĻ°ā§āĻĻāĻŋāĻˇā§āĻ āĻļāĻ°ā§āĻ¤ āĻ
āĻ¨ā§āĻ¯āĻžāĻ¯āĻŧā§ āĻā§āĻĄā§āĻ° íāĻžā§ āĻĒāĻ°āĻŋāĻŦāĻ°ā§āĻ¤āĻ¨ āĻāĻ°āĻžāĻ° āĻāĻ¨ā§āĻ¯āĨ¤ āĻāĻā§āĻ˛āĻŋ āĻŦāĻŋāĻāĻŋāĻ¨ā§āĻ¨ āĻļāĻ°ā§āĻ¤ā§āĻ° āĻāĻŋāĻ¤ā§āĻ¤āĻŋāĻ¤ā§ āĻā§āĻĄā§āĻ° āĻĒā§āĻ°āĻŦāĻžāĻš āĻ¨āĻŋāĻ¯āĻŧāĻ¨ā§āĻ¤ā§āĻ°āĻŖ āĻāĻ°ā§āĨ¤
ā§§. if
Statement
if
statement āĻļāĻ°ā§āĻ¤ā§āĻ° āĻāĻŋāĻ¤ā§āĻ¤āĻŋāĻ¤ā§ āĻāĻāĻāĻŋ āĻā§āĻĄ āĻŦā§āĻ˛āĻ āĻāĻžāĻ˛āĻžāĻ¨ā§āĻ° āĻāĻ¨ā§āĻ¯ āĻŦā§āĻ¯āĻŦāĻšā§āĻ¤ āĻšāĻ¯āĻŧāĨ¤ āĻ¯āĻĻāĻŋ āĻļāĻ°ā§āĻ¤āĻāĻŋ true
āĻšāĻ¯āĻŧ, āĻ¤āĻžāĻšāĻ˛ā§ āĻā§āĻĄ āĻŦā§āĻ˛āĻāĻāĻŋ āĻāĻ˛āĻŦā§āĨ¤
Syntax:
if (condition) {
// code to be executed if condition is true
}
Example:
int num = 10;
if (num > 5) {
print('The number is greater than 5');
}
āĻāĻāĻžāĻ¨ā§, num > 5
āĻļāĻ°ā§āĻ¤āĻāĻŋ true
āĻšāĻāĻ¯āĻŧāĻžāĻ¯āĻŧ print
āĻ¸ā§āĻā§āĻāĻŽā§āĻ¨ā§āĻāĻāĻŋ āĻāĻžāĻ˛ā§ āĻšāĻŦā§āĨ¤
ā§¨. else
Statement
else
statement āĻ¤āĻāĻ¨ āĻŦā§āĻ¯āĻŦāĻšā§āĻ¤ āĻšāĻ¯āĻŧ āĻ¯āĻāĻ¨ if
āĻļāĻ°ā§āĻ¤āĻāĻŋ false
āĻšāĻ¯āĻŧāĨ¤ āĻ
āĻ°ā§āĻĨāĻžā§, āĻ¯āĻĻāĻŋ if
āĻļāĻ°ā§āĻ¤āĻāĻŋ āĻĒā§āĻ°ā§āĻŖ āĻ¨āĻž āĻšāĻ¯āĻŧ, āĻ¤āĻžāĻšāĻ˛ā§ else
āĻŦā§āĻ˛āĻāĻāĻŋ āĻāĻ˛āĻŦā§āĨ¤
Syntax:
if (condition) {
// code to be executed if condition is true
} else {
// code to be executed if condition is false
}
Example:
int num = 3;
if (num > 5) {
print('The number is greater than 5');
} else {
print('The number is not greater than 5');
}
āĻāĻāĻžāĻ¨ā§, num > 5
āĻļāĻ°ā§āĻ¤āĻāĻŋ false
āĻšāĻāĻ¯āĻŧāĻžāĻ¯āĻŧ else
āĻŦā§āĻ˛āĻāĻāĻŋ āĻāĻžāĻ°ā§āĻ¯āĻāĻ° āĻšāĻŦā§ āĻāĻŦāĻ "The number is not greater than 5" āĻĒā§āĻ°āĻŋāĻ¨ā§āĻ āĻšāĻŦā§āĨ¤
ā§Š. else if
Statement
āĻ¯āĻāĻ¨ āĻāĻāĻžāĻ§āĻŋāĻ āĻļāĻ°ā§āĻ¤ āĻā§āĻ āĻāĻ°āĻ¤ā§ āĻšāĻ¯āĻŧ, āĻ¤āĻāĻ¨ else if
āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ° āĻāĻ°āĻž āĻšāĻ¯āĻŧāĨ¤ āĻāĻāĻžāĻ§āĻŋāĻ āĻļāĻ°ā§āĻ¤ āĻĒāĻ°ā§āĻā§āĻˇāĻž āĻāĻ°āĻ¤ā§, āĻĒā§āĻ°āĻĨāĻŽā§ if
āĻŦā§āĻ˛āĻāĻāĻŋ āĻā§āĻ āĻšāĻ¯āĻŧ, āĻ¤āĻžāĻ°āĻĒāĻ° else if
āĻļāĻ°ā§āĻ¤āĻā§āĻ˛ā§ āĻā§āĻ āĻāĻ°āĻž āĻšāĻ¯āĻŧ, āĻāĻŦāĻ āĻ
āĻŦāĻļā§āĻˇā§ else
āĻŦā§āĻ˛āĻāĻāĻŋ āĻāĻžāĻ˛āĻžāĻ¨ā§ āĻšāĻ¯āĻŧ āĻ¯āĻĻāĻŋ āĻā§āĻ¨ āĻļāĻ°ā§āĻ¤āĻ āĻ¸āĻ āĻŋāĻ āĻ¨āĻž āĻšāĻ¯āĻŧāĨ¤
Syntax:
if (condition1) {
// code to be executed if condition1 is true
} else if (condition2) {
// code to be executed if condition2 is true
} else {
// code to be executed if none of the conditions are true
}
Example:
int num = 7;
if (num > 10) {
print('The number is greater than 10');
} else if (num == 7) {
print('The number is 7');
} else {
print('The number is less than 10');
}
āĻāĻāĻžāĻ¨ā§, num == 7
āĻļāĻ°ā§āĻ¤āĻāĻŋ true
āĻšāĻāĻ¯āĻŧāĻžāĻ¯āĻŧ "The number is 7" āĻĒā§āĻ°āĻŋāĻ¨ā§āĻ āĻšāĻŦā§āĨ¤
āĻ¸āĻāĻā§āĻˇā§āĻĒā§:
-
if
statement: āĻļāĻ°ā§āĻ¤ āĻĒā§āĻ°ā§āĻŖ āĻšāĻ˛ā§ āĻā§āĻĄ āĻŦā§āĻ˛āĻ āĻāĻ˛ā§āĨ¤ -
else
statement:if
āĻļāĻ°ā§āĻ¤ āĻĒā§āĻ°ā§āĻŖ āĻ¨āĻž āĻšāĻ˛ā§ āĻāĻāĻŋ āĻāĻ˛ā§āĨ¤ -
else if
statement: āĻāĻāĻžāĻ§āĻŋāĻ āĻļāĻ°ā§āĻ¤ āĻĒāĻ°ā§āĻā§āĻˇāĻž āĻāĻ°ā§, āĻĒā§āĻ°āĻĨāĻŽ āĻļāĻ°ā§āĻ¤ āĻĒā§āĻ°ā§āĻŖ āĻšāĻ˛ā§ āĻ¸ā§ āĻā§āĻĄ āĻŦā§āĻ˛āĻ āĻāĻ˛ā§, āĻ āĻ¨ā§āĻ¯āĻĨāĻžāĻ¯āĻŧ āĻĒāĻ°āĻŦāĻ°ā§āĻ¤ā§ āĻļāĻ°ā§āĻ¤ āĻā§āĻ āĻāĻ°āĻž āĻšāĻ¯āĻŧāĨ¤
Featured ones: