Asp.net if else Condition Statement usage (vb.net)

Source: Internet
Author: User

The statement block in the If condition is also a group of if conditions, and the statement block is a group of if conditions.

Until the condition is set.

In general, the most complex conditional statements are nested conditional statements.

All conditional statement formats can form nested conditional statements, as long as the syntax concept is clear

Chu

If then

<Script runat = "server">
Sub Page_Load (Sender as object, e as eventargs)
Dim MyMessage As String = "Hello"
Dim MyBool As Boolean = True

If MyMessage = "Hello" then
Response. Write ("True ")
End if

If MyBool then
Response. Write ("True ")
End if
End sub
</Script>

The following is a complex statement.

If condition 1 Then
If condition 2 Then
Statement Block 1
Else
Statement Block 1-2
End I f
Other statements
Else
Statement Block 2
End If

Simple instance

<% @ Page Language = "C #" %>

<Script runat = "server">
Void Page_Load (Object Sender, EventArgs e ){
String MyMessage = "Hello ";
Bool MyBool = true;

If (MyMessage = "Hi" & MyBool ){
Response. Write (MyMessage );
} Else if (MyMessage = "Hello "){
Response. Write ("True ");
} Else {
Response. Write ("False ");
}

If (! MyBool ){
Response. Write ("False ");
}
}
</Script>

<Html> <body>

</Body>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.