1828214 Members
2516 Online
109975 Solutions
New Discussion

Re: Why Why Why?

 
SOLVED
Go to solution
Davor_7
Regular Advisor

Why Why Why?

Davor A5WS2> n:=1
$ disk = "f_"+n
$ sh sym disk
DISK = "f_1"
$ n=n+1
$ sh sym n
N = 2 Hex = 00000002 Octal = 00000000002
$ disk = "f_"+n
$ sh sym disk
DISK = 2 Hex = 00000002 Octal = 00000000002

why it's not DISK = "f_2" ??
4 REPLIES 4
Heinz W Genhart
Honored Contributor
Solution

Re: Why Why Why?

Hi Davor

try this one

$ n=1
$ disk = "f_''n'"
$ sh sym disk
$ n=n+1
$ sh sym n
$ disk = "f_''n'"
$ sh sym disk

This will give the following Output

DISK = "f_1"
N = 2 Hex = 00000002 Octal = 00000000002
DISK = "f_2"


Regards

Heinz
Davor_7
Regular Advisor

Re: Why Why Why?

thank you :)

also, i have find another way to use f$string :)
it's the problem on the data format :p
Robert_Boyd
Respected Contributor

Re: Why Why Why?

The answer to your question is that in the first case n and "f_" are both treated as strings.

In the 2nd case n is treated as a numeric variable and when a numeric variable is "added" to a string variable you get a numeric result.

You could use $ disk = "f_"+f$string(n)
or $ disk = "f_"+"''n'"
or $ disk = "f_''n'"
or $ disk = f$fao("f_!SL",n)

and probably some other interesting variations that don't come to mind at the moment.

Robert
Master you were right about 1 thing -- the negotiations were SHORT!
Davor_7
Regular Advisor

Re: Why Why Why?

yes. that's the only reason to explain it~ hehe:)

thanks~