Minor variable bug

Got a problem you cannot solve? Try here.
zchris
Posts: 92
Joined: Wed Feb 23, 2005 3:16 am
Location: Austria

Minor variable bug

Postby zchris » Fri Sep 02, 2005 3:13 am

Run this code:

Code: Select all

Set Variable AA to V1
Set Variable BB to V2
MessageBox Test, $AA$BB$AA$ - $BB$AA$BB$


The result is "V1BBV1 - $BBV1BB$" instead of "V1BBV1 - V2AAV2".

sinan
Site Admin
Posts: 1020
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Postby sinan » Fri Sep 02, 2005 4:58 am

I'm not sure I see what the problem is? If you would like all variables to be dereferenced, you need to include more dollar signs, like so:

Code: Select all

$AA$$BB$$AA$, $BB$$AA$$BB$


Please let me know if I am misunderstanding anything.

zchris
Posts: 92
Joined: Wed Feb 23, 2005 3:16 am
Location: Austria

Postby zchris » Mon Sep 05, 2005 2:37 am

The problem is that in $BB$AA$BB$ it is dereferencing the variable $AA$ even though I did not specify the variable - I only specified the string AA.

So for $BB$AA$BB$ I would expect it to only replace the two variables $BB$ resulting in V2AAV2.

sinan
Site Admin
Posts: 1020
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Postby sinan » Mon Sep 05, 2005 4:05 am

I see what you mean. That is interesting. Variables are substituted in order of their declaration. So indeed, the parser notices $AA$, and substitutes that first, before even getting to $BB$.

Does that help you with the problem?

zchris
Posts: 92
Joined: Wed Feb 23, 2005 3:16 am
Location: Austria

Postby zchris » Tue Sep 06, 2005 3:25 am

I thought this was a bug because the installer produced a different result than I expected. If you say this is by design then that's OK with me.

Thanks.

sinan
Site Admin
Posts: 1020
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Postby sinan » Tue Sep 06, 2005 6:17 am

Yes, this is by design :)


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 38 guests