Visual Basic Statements and Expressions
· The simplest statement is the assignment statement. It consists of a variable name, followed by the assignment operator (=), followed by some
sort of expression.
Examples:
StartTime = Now
Explorer.Caption = "Captain Spaulding"
BitCount = ByteCount * 8
Energy = Mass * LIGHTSPEED ^ 2
NetWorth = Assets - Liabilities
The assignment statement stores information.
· Statements normally take up a single line with no termi nator. Statements can be stacked by using a colon (:) to separate them. Example:
StartTime = Now : EndTime = StartTime + 10
(Be careful stacking statements, especially with If/End If structures. You may not get the response you desire.)
· If a statement is very long, it may be continued to the next line using the
continuation character, an underscore (_). Example:
Months = Log(Final * IntRate / Deposit + 1) _
/ Log(1 + IntRate)
· Comment statements begin with the keyword Rem or a single quote ('). For
example:
Rem This is a remark
' This is also a remark
x = 2 * y ' another way to write a remark or comment
You, as a programmer, should decide how much to comment your code.
Consider such factors as reuse, your audience, and the legacy of your code.
0 comments:
Post a Comment
Dear Visitors All The Tricks And Hacks Posted Here Are Only For Knowledge Purpose.Don't Use These for Illegal Operations.