ngothanhtottenham
New member
`` `C#
// c# nếu câu lệnh khác
// Câu lệnh IF khác là một câu lệnh có điều kiện cho phép bạn thực thi mã khác nhau tùy thuộc vào điều kiện là đúng hay sai.
// Cú pháp
`` `
if (điều kiện) {
// mã sẽ được thực thi nếu điều kiện là đúng
} khác {
// mã sẽ được thực thi nếu điều kiện là sai
}
// Ví dụ
`` `
int số = 5;
if (số % 2 == 0) {
Console.WriteLine ("Số chẵn.");
} khác {
Console.WriteLine ("Số là lẻ.");
}
`` `
// đầu ra
`` `
Số là lẻ.
`` `
## 5 hashtags
* #C#
* #câu điều kiện
* #Nếu tuyên bố khác
* #Programming
* #tutorial
`` `
=======================================
```c#
// C# If Else Statement
// The if else statement is a conditional statement that allows you to execute different code depending on whether a condition is true or false.
// Syntax
```
if (condition) {
// code to be executed if condition is true
} else {
// code to be executed if condition is false
}
// Example
```
int number = 5;
if (number % 2 == 0) {
Console.WriteLine("The number is even.");
} else {
Console.WriteLine("The number is odd.");
}
```
// Output
```
The number is odd.
```
## 5 Hashtags
* #C#
* #Conditional Statements
* #If Else Statement
* #Programming
* #tutorial
```
// c# nếu câu lệnh khác
// Câu lệnh IF khác là một câu lệnh có điều kiện cho phép bạn thực thi mã khác nhau tùy thuộc vào điều kiện là đúng hay sai.
// Cú pháp
`` `
if (điều kiện) {
// mã sẽ được thực thi nếu điều kiện là đúng
} khác {
// mã sẽ được thực thi nếu điều kiện là sai
}
// Ví dụ
`` `
int số = 5;
if (số % 2 == 0) {
Console.WriteLine ("Số chẵn.");
} khác {
Console.WriteLine ("Số là lẻ.");
}
`` `
// đầu ra
`` `
Số là lẻ.
`` `
## 5 hashtags
* #C#
* #câu điều kiện
* #Nếu tuyên bố khác
* #Programming
* #tutorial
`` `
=======================================
```c#
// C# If Else Statement
// The if else statement is a conditional statement that allows you to execute different code depending on whether a condition is true or false.
// Syntax
```
if (condition) {
// code to be executed if condition is true
} else {
// code to be executed if condition is false
}
// Example
```
int number = 5;
if (number % 2 == 0) {
Console.WriteLine("The number is even.");
} else {
Console.WriteLine("The number is odd.");
}
```
// Output
```
The number is odd.
```
## 5 Hashtags
* #C#
* #Conditional Statements
* #If Else Statement
* #Programming
* #tutorial
```