Page 1 of 2

Difference between $ and .s ?

Posted: Wed Aug 06, 2003 4:05 pm
by Karbon
Someone just told me that there was a difference between

mystring$ and mystring.s

Can someone smack me around with a clue stick? Either I've overlooked it in the docs or the difference isn't in there..

Thanks!

Posted: Wed Aug 06, 2003 5:04 pm
by Pupil
As far as i know there's no difference... correction there is one difference that i can see -it's that you get to type in one less character with the non-$-version when you use it later in your program ;)

Posted: Wed Aug 06, 2003 5:17 pm
by GPI
Simple, there is no diffrent.

ok, only one

after:
String.s="Hello"
you can write
String+" everyone".

with $, you must allways add the $.

Posted: Wed Aug 06, 2003 6:00 pm
by GedB
Another difference is that this is allowed

Code: Select all

A$ = "Hello"
A.l = 5
But this is not

Code: Select all

A.s = "Hello"
A.l = 5

Posted: Wed Aug 06, 2003 6:54 pm
by Karbon
Thanks guys :-)

Posted: Wed Aug 06, 2003 9:00 pm
by matthew180
The $ and .s internal variable spaces are not the same.

a$ = "Hello"
a.s = "World"
debug a$
debug a.s

Output:
Hello
World

You would *expect* the result to be:

World
World

Seems the $ is just like the * is to pointers, i.e. is becomes part of the variable name and not really any sort of operator. Once you define a pointer, you have to always use the * with the name, same with the $ for strings.

Now, as for the difference between variables defined with a $ or .s, unfortunately only Fred can tell you that...

Matthew

Posted: Wed Aug 06, 2003 9:05 pm
by Fred
It's for BASIC compatibility, MyVar is different than MyVar$. That's it. In PB, I've added the .s for those which gets bored with the ended '$', but it's exactly the same internally.

Posted: Wed Aug 06, 2003 9:06 pm
by Karbon
Exxxxxcellent. Thanks Fred.

Posted: Mon Aug 11, 2003 9:50 am
by TronDoc
Fred wrote:It's for BASIC compatibility
I appreciate being able to use the '$' :D Joe

Posted: Mon Aug 11, 2003 11:57 am
by Rings
TronDoc wrote:
Fred wrote:It's for BASIC compatibility
I appreciate being able to use the '$' :D Joe
sorry joe, $ sounds to american ;)

Posted: Mon Aug 11, 2003 1:03 pm
by Berikco
I like the $ also very much, never use .s
Maybe for Rings, Fred can introduce the € euro sign Image

Posted: Mon Aug 11, 2003 1:58 pm
by freedimension
Berikco wrote:Maybe for Rings, Fred can introduce the € euro sign
Yeah, but for handling my bank account I would need 64bit Integers. ;-)

Hmmm...

Posted: Mon Aug 11, 2003 3:55 pm
by LJ
You can always give me your bank acct#. and access to your account and I'm sure I could find a 32bit work around solution. :wink:

Posted: Mon Aug 11, 2003 4:15 pm
by Kale
I'm sure I could find a 32bit work around solution.
lol :lol:

Posted: Mon Aug 11, 2003 5:01 pm
by TronDoc
LOL :lol: