Posts: 1,271
Threads: 399
Joined: Mar 2003
i guess i forgot something.
why is this working (both times a2 has value 'context'):
ff2qm2
/
function [$a1] [$a2]
sel a2
,case "context"
,,mes a2
,case else
,,mes a1
and this not ?
ff2qm
/
function [$a1] [$a2]
if(a2=="context")
,mes a2
else
,mes a1
Posts: 12,065
Threads: 140
Joined: Dec 2002
== compares strings if left operand is str. If it is lpstr, compares pointers. Use sel or matchw or strcmp or q_strcimp.
Posts: 1,271
Threads: 399
Joined: Mar 2003
i thought $a2 makes it str.
Posts: 12,065
Threads: 140
Joined: Dec 2002
Using lpstr for function arguments is better than str because:
1. Better performance. str would allocate and copy string.
2. Error when accidentally trying to pass a number.
Use str if:
1. Performance is not important, or the string would be copied to str variable inside the function anyway.
2. To be able to pass strings and numbers. When you assign a number to a str variable, it is automatically converted to string.
Posts: 1,271
Threads: 399
Joined: Mar 2003