logo
g Text Version
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Sports
Travel & Culture
TV & Movies

dailyclick
Bored? Games!
Nutrition
Postcards
Take a Quiz
Rate My Photo

new
Creativity
Family Travel
Southwest USA
Irish Culture
Home Finance
Comedy Movies
Romance Novels


dailyclick
All times in EST

Full Schedule
g
g ASP Site

BellaOnline's ASP Editor

g

Naming and Defining Variables

Guest Author - Lisa Shea

One of the key features of using ASP is the ability to use and manipulate variables. How do you create a date-type variable? How about a numeric, or string variable? The answers are clearly laid out in this article.

How should you name variables? There are all sorts of conventions. Some people like a convention like sFirstName, meaning "string type variable, holding a first name". Others just like the content - BackColor for the value of the background color, for example. Whatever you do, be descriptive and reasonably lengthed. Don't go for variables like "i" and "j", those drive you crazy when you're trying to debug later. And don't go for variables like "lastnameofprimarycontact" - that makes it nearly impossible to read through the code.

So lets say you name your variables short but meaningful names - names like SiteName or UserName or SiteID. How do you use them?

For a regular variable, you simply assign a value to it. You don't have to predefine it - it knows by what type of variable you're assigning to it what sort of a variable it is. So if you say:

SiteName = "ASP"

it knows it's a text variable that you can do text operations on. If you say

BooksOrdered = 13

then it knows it's a numeric variable and that you can do addition and subtraction to it.

The date subtype needs a special format so that the system doesn't think it's just a string or a division problem :). You use # signs to indicate it's a date, as in:

DateStarted = #01/15/2001#

Also, if you want to use booleans (true/false), you simply use TRUE or FALSE as your values. So:

FinishedTask = TRUE

Introduction to ASP Ebook

Download this ebook to get everything you need to know about learning ASP - from a step by step tutorial to function lists, sample code, common errors and solutions, and much more! 101 pages.
This site needs an editor - click to learn more!

Add Naming+and+Defining+Variables to Twitter Add Naming+and+Defining+Variables to Facebook Add Naming+and+Defining+Variables to MySpace Add Naming+and+Defining+Variables to Del.icio.us Digg Naming+and+Defining+Variables Add Naming+and+Defining+Variables to Yahoo My Web Add Naming+and+Defining+Variables to Google Bookmarks Add Naming+and+Defining+Variables to Stumbleupon Add Naming+and+Defining+Variables to Reddit




RSS | Editor's Picks Articles | Top Ten Articles | Previous Features | Site Map


For FREE email updates, subscribe to the ASP Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor


Content copyright © 2014 by Lisa Shea. All rights reserved.
This content was written by Lisa Shea. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.

g


g features
Best uses for RSS

RSS and its future.

Force Download Dialog box with ASP

Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Poetry
Daily
Weekly
Monthly
Less than Monthly



BellaOnline on Facebook
g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2014 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor