Current .Net Version: 1.1.4322
(select below)
.Net Framework
ASP.NET/Web Forms
C#
SQL Server
Visual C#
Windows Forms
XML Web Services
C# Reference
List:
Access Keyword
Access Modifier Keyword
Attribute
Conversion Keyword
Definition
Literal Keyword
Method Parameter Keyword
Modifier Keyword
Namespace Keyword
Operator
Operator Keyword
Preprocessor Directive
Statement Keyword
Type
Type Keyword
Search:
if-else
Is a:
Statement Keyword
Applies to Version:
C# 1.0 and later
Namespace:
N/A
Assembly:
N/A (N/A)
Description:
A
statement
that controls the execution a
block
of code if an
expression
evaluates to true. If the
expression
evalutes to true, the first
statement
is executed, otherwise, the second
statement
it executed.
Syntax:
if (
expression
)
statement
1 [else
statement
2]
Example(s):
bool bln1 = false; if (bln) MessageBox.Show("It's TRUE!"); else MessageBox.Show("It's FALSE!"); if (bln == true) { MessageBox.Show("It's TRUE!"); } else MessageBox.Show("It's FALSE!"); if (bln == false) { MessageBox.Show("It's FALSE!"); } else { MessageBox.Show("It's TRUE!"); }
COPYRIGHT/DISCLAIMER
|
CONTACT US