In VB. NET how to achieve similar functions in C # continue
Source: Internet
Author: User
The following C # code:
int sum=0;
for (int i=1;i<101;i++)
{
if (i%2!=0)
{
Continue
}
Sum+=i;
}
You might consider implementing the following vb.net code:
Dim sum As Integer, I As Integer
For i = 1 to 100
If (i Mod 2 = 0) Then
sum = sum + I
End If
Next
Dim sum As Integer, I As Integer
For i = 1 to 100
If (i Mod 2 <> 0) Then
GoTo continue
End If
sum = sum + I
Continue
Next
In addition, in vb.net 2005, the continue syntax has been implemented
For i as Integer = 0 to 100
If i = Skip Console.WriteLine statement
If i = Then Continue for
Console.WriteLine (i.tostring)
Next
Do while using Continue statement.
Dim II as Integer = 1
Do While II < 100
II + + 1
If i = Skip Console.WriteLine statement
If II = Then Continue do
Console.WriteLine (Ii. ToString)
Loop
While using Continue statement.
Dim III as Integer = 1
While III < 100
III + + 1
If i = Skip Console.WriteLine statement
If III = Then Continue while
Console.WriteLine (Iii. ToString)
End While
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