הערה
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות להיכנס או לשנות מדריכי כתובות.
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות לשנות מדריכי כתובות.
Question
Thursday, December 3, 2015 5:04 AM
hello, I've got this if statement from MSDN and i didn't understand what does the colon do in vb.net
If A > 10 Then A = A + 1 : B = B + A : C = C + B
All replies (3)
Thursday, December 3, 2015 5:21 AM ✅Answered
It's the line-join character - it allows you to place more than one VB statement on one line.
It's equivalent to:
If A > 10 Then
A = A + 1
B = B + A
C = C + B
End If
To further complicate things, VB allows you to omit the "End If" when you use a single-line "If" statement, with or without line joins.
Convert between VB, C#, C++, & Java (http://www.tangiblesoftwaresolutions.com)
Instant C# - VB to C# Converter
Instant VB - C# to VB Converter
Thursday, December 3, 2015 5:22 AM
https://msdn.microsoft.com/en-us/library/xxda45fy.aspx?f=255&MSPPError=-2147217396
Separators do what their name suggests: they separate sections of code. In Visual Basic, the separator character is the colon (:). Use separators when you want to include multiple statements on a single line instead of separate lines. This saves space and improves the readability of your code. The following example shows three statements separated by colons.
Thursday, December 3, 2015 2:14 PM
The colon is a statement delimiter, same as pressing the Enter key at the end of a line of code.
It's useful for very short statements that will print on a single line. For example:
a = 5 : b = 8 : c = 12
Solitaire