Re: question(s) about declaring variables
- From: erewhon@xxxxxxxxxx (J French)
- Date: Mon, 27 Jun 2005 09:49:23 +0000 (UTC)
On Sun, 26 Jun 2005 16:31:16 -0400, "Steve Easton"
<admin@xxxxxxxxxxxxx> wrote:
>1st. Which is better for a variable that is going to be used for text. Letting a variable be a
>variant or declaring it as a string. According to MSDN, variants are more "versatile" ( if I'm
>reading it right. )
The other name for Variants is 'Deviants'
- avoid them or you'll suffer
>2nd. Why do all code examples use "As String to" declare each variable like this:
>Dim var1 As String
>Public var2 As String.
Because that is the new and trendy way of declaring variables
>instead of using the $ type-declaration character like this:
>Dim var1$
>Public var2 $
You'll find a lot of canny coders still do that
- even in (the better) examples from MS
>3rd. Why a separate line for each variable
>I realize that declaring them like this:
>Dim var1, var2, var3 As String
>makes var1 and var2 variants and only var3 is declared as a string.
>when done this way however:
>
>Dim var1$, var2$, var3$
>They are all recognized as String variables.
Because there is a Default Type for VB
- it is historical
- absurdly the default has migrated over the years from Single, Double
to Deviant
Stick: DefObj A-Z at the top of /all/ your code and it will save you
many visits to a tricologist.
>Thus concludes my dumb question(s) for today.
If this is homework, then your teacher is better than most.
Normally I don't do homework (unless I do)
However the real answer to the underlying questions is that the very
first BASIC came from Dartmouth and had two types of variables
A$ - this is a string
A - this is some sort of a number
Later 'street BASICS' mostly written by Microsoft, invented different
types of numbers % ! # & @ in that sequence
When they ran out of funny characters to stick at the end of a 'name'
they started denigrating the idea of 'suffix designation'
A bit daft
- as they could not see the difference between the wood and the nails
.
- Follow-Ups:
- Re: question(s) about declaring variables
- From: Steve Easton
- Re: question(s) about declaring variables
- References:
- question(s) about declaring variables
- From: Steve Easton
- question(s) about declaring variables
- Prev by Date: Re: Resolving IP Addresses
- Next by Date: Re: Resolving IP Addresses
- Previous by thread: Re: question(s) about declaring variables
- Next by thread: Re: question(s) about declaring variables
- Index(es):
Relevant Pages
|
Loading