39 lines
799 B
Markdown
39 lines
799 B
Markdown
---
|
|
title: If Else Statement
|
|
localeTitle: إذا كان البيان الآخر
|
|
---
|
|
# إذا كان البيان الآخر
|
|
|
|
ينفّذ بيان If-Else كتلة من الكود بناءً على ما إذا كان شرطك الكامل ممتلئًا أم لا.
|
|
|
|
## مثال
|
|
|
|
`if(boolean expression)
|
|
{
|
|
// execute this code block if expression evalutes to true
|
|
}
|
|
else
|
|
{
|
|
// always execute this code block when above if expression is false
|
|
}
|
|
|
|
|
|
int Price = 30;
|
|
|
|
If (Price = 30)
|
|
{
|
|
Console.WriteLine("Price is equal to 30.");
|
|
}
|
|
|
|
Else
|
|
{
|
|
Console.WriteLine("Price is not equal to 30.");
|
|
}
|
|
`
|
|
|
|
بما أننا أعلنا بالفعل أن السعر لدينا هو 30 ، سيكون هذا هو الناتج المتوقع.
|
|
|
|
## انتاج |
|
|
|
|
`Price is equal to 30.
|
|
` |