Computer Programming VB - Net.docx 2
Computer Programming VB - Net.docx 2
Access Modifiers
When using variables, you also have to consider their accessibility to all areas of your code that refer to them. In
some cases, you might need to restrict user access to some of the variables that you have created. For this purpose, you
can use the different access modifiers available in VB.NET:
This code shows you how to declare a variable using some of the access modifiers mentioned:
You can also assign a value to a variable when you declare it, as shown here:
The “=” symbol is commonly used as the assignment operator symbol for most programming languages.
However, this can sometimes cause people to confuse it with the equivalence operator in relational expressions. In an
assignment statement, the expression on the right-hand side is first evaluated and then its value is assigned to the
variable on the left.
Working with Operators and Making Choices
Arithmetic Operators
Arithmetic operators are symbols used to perform arithmetic operations on variables. Below are some of the
commonly used arithmetic operators:
Comparison Operators
Comparison operators are used to compare two values and perform an action based on the result of the comparison.
Some commonly used comparison operators are listed here:
Logical Operators
To better understand how they work, you must learn how to use the truth table:
Logical operators are used to evaluate expressions and return to a Boolean value. Some commonly used logical
operations:
Concatenation Operators
Concatenation operators are used to join two expressions. Some commonly used concatenation operators: