| You are here: | About>Computing & Technology>Visual Basic> Learn VB.NET> Visual Basic .NET 2008 Express - Visual Basic Fundamentals |
![]() | Visual Basic |
Visual Basic .NET 2008 Express - Visual Basic FundamentalsFeb 14 2008 Operations on DataAfter you declare a name for a piece of data, the next thing is usually to do some operation with the data. An example of an operation is one half of an assignment operation that we have already seen (see "assignment statement" above). Microsoft classifies all Visual Basic operators as
i = 4 + 6 * 7 ... results in a value of 46 in the variable i. But ... i = (4 + 6) * 7 ... results in a value of 70 in i.
There are six comparison operators:
It's worth knowing that the Boolean value that is a result of a comparison operation is just True or False. It's not a simple number like it used to be in VB6. Microsoft has this to say about the Boolean data type: When numeric data types are converted to Boolean values, 0 becomes False and all other values become True. When Boolean values are converted to numeric types, False becomes 0 and True becomes -1. Some old VB6 programs use the values 0 and -1 instead of True and False. Never do that in VB.NET. Microsoft puts the logical operators, And, Or, AndAlso, OrElse, Xor and the Not operator in their own category because they only operate on Boolean variables. If you ever get confused about how these work, I recommend that you try diagramming them using what is called a Truth Table or Karnaugh Map.
Just two operators, "+" and "&", which both do almost the same thing: join two strings into one. "+" is also an arithmetic operator so if you only want to concatenate strings, use "&". On the next page, we use Boolean variables to write the conditional statements that are really the only way that computers have any flexibilty to do more than one thing. |
Las Vegas on a BudgetFind a BargainHotel DealsCheap EatsFree AttractionsEntertainment for Less |
All Topics | Email Article | | | ![]() |
| Advertising Info | News & Events | Work at About | SiteMap | Reprints | Help | Our Story | Be a Guide |
| User Agreement | Ethics Policy | Patent Info. | Privacy Policy | ©2008 About, Inc., A part of The New York Times Company. All rights reserved. |


