What does a dollar sign do when it's affixed to the end of a variable? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

What does a dollar sign do when it's affixed to the end of a variable?

nethervoidnethervoid Posts: 4Member
I'm working with some code patched together from about 5 different people, and I came across a set of variables each having a dollar sign at the end of their names. ????? Anybody know what this implies or does?

Never seen this before.

Comments

  • PavlinIIPavlinII Posts: 404Member
    : I'm working with some code patched together from about 5 different people, and I came across a set of variables each having a dollar sign at the end of their names. ????? Anybody know what this implies or does?
    :
    : Never seen this before.
    :
    Hi,
    $ at the end of variable means that the variable has type of string.
    Theese pairs means the same
    [code]Dim StrVariable As String
    Dim StrVariable$
    -
    Dim IntVariable As Integer
    Dim IntVariable%
    -
    Dim LngVariable As Long
    Dim LngVariable&
    -
    Dim DecVariable As Decimal
    Dim DecVariable@
    -
    Dim SngVariable As Single
    Dim SngVariable!
    -
    Dim DblVariable As Double
    Dim DblVariable#[/code]
    Use named declaration of variables. When you use character resolution, you may have some problems..
    VB - without "option explicit" - when you define s$ and use s, you made new s variable of variant, it will cause a lot of problems to you..
    VB - with "option explicit" - compiler will tell you that you've used s variable (and defined s$) but you still have to write $ character each time you need your variable and your code is not clear a and readable..
    VB.NET - you can use Dim s$ to declare string and then use "s" to work with it, this is not danger but code is not "clear"..


    [blue][b][italic][size=4]P[/size]avlin [size=4]II[/italic][/size][/b][/blue]

    [purple]Don't take life too seriously anyway you won't escape alive from it![/purple]


Sign In or Register to comment.