CSC142 - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

CSC142

Description:

All data used by a program is stored in the. memory of the computer ... double quotes ('), e.g. strMessage = 'Welcome to VB.NET') Dim strMessage As String ... – PowerPoint PPT presentation

Number of Views:31
Avg rating:3.0/5.0
Slides: 14
Provided by: francoisl4
Category:

less

Transcript and Presenter's Notes

Title: CSC142


1
(No Transcript)
2
(No Transcript)
3
All data used by a program is stored in
the memory of the computer (numbers, names).
4
Location 4 contains 0.981 Location 2
contains the letter c
In a program do not use the location number
(address) explicitly dont want to say
take the content of box
4 would drive us crazy!
5
VB.NET strictly enforces the rule. By default it
has Option Explicit on. Dont turn it off! It is
also a good idea to turn Option Strict on to
prevent accidental conversions between types (see
later).
6
Many different types some examples
An integer can be 1, -46, 236 (NOT 1.5, -2.3)
7
(No Transcript)
8
To make your code easier to understand, use the
following stylistic guidelines
_ precede the name of every variable,
constants, or object with a lowercase prefix
specifying the data type. (Hungarian notation
see list p 99)
_ Capitalize each first letter of each word of
a name, e.g. intNumberOfChildren
_ use letters, numbers strEmployee1SSN
_ cant start with a number or underscore
_bad,
1_not_good _ Names cant contain spaces or
periods
9
_cant be a VB.NET keyword
End, Dim, As ...
_NOT case sensitive temperature is the
same as Temperature
_ length practically, as long as you want
(the limit is 16,383 characters, but...)
_ meaningful names Dim intAge As Integer
NOT Dim a As Integer
VB will help you as you type...
10
Within a program, some values do not
change e.g. value of pi 3.14159
To avoid any accidental change, declare such
values as constants
Const dblPI As Double 3.14159
VB provides a set of built in constants.
(intrinsic constants). You need to specify
class name and constant name, e.g. Color.Red
11
We have seen String, Integer, Double
Also
Uses lots of memory, not as efficient. Avoid if
you can
12
Declare a variable
We get a box. But how to put something in it?
Or better said How to store the value of
a variable in the memory?
Dim strName As String strName "Jane Beckmann"
13
Consider dblPerimeter
dblPIdblDiameter
Note can have intYear intYear 1
(NOT a mathematical equation!)
Write a Comment
User Comments (0)
About PowerShow.com