Something strange about assignement

if i do an assignment like :

valid_path=valid_string and (/^/.*$/ === s)

s being = to “path not starting with /” (invalid path)*

i get valid_path= true iff alid_string=true

the test “” doesn’t take into account, why ???

because i’ve changed slightly the syntax to :

valid_path=(valid_string and (/^/.*$/ === s))

(an enclosing parentheses couple more)

and then, rubically, i get the good result :wink:

any reason for such a behaviour ???

Hello !

valid_path=(valid_string and (/^/.*$/ === s))

(an enclosing parentheses couple more)

and then, rubically, i get the good result :wink:

any reason for such a behaviour ???

and has got a much lower priority than anything else (including the
assignement), so that your first statement is interpreted as

(valid_path=valid_string) and (/^/.*$/ === s)

You wouldn’t get this problem with the && operator – and as you did
if you parenthize correctly.

Enjoy

Vince

Vincent F. [email protected] wrote:

and has got a much lower priority than anything else (including the
assignement), so that your first statement is interpreted as

i didn’t know that point ))

(valid_path=valid_string) and (/^/.*$/ === s)

You wouldn’t get this problem with the && operator – and as you did
if you parenthize correctly.

ok, thanks !