Dear all,
I usually use google chrome
ukr.net has its own mail editor
This one is sent by firefox
Also the script is attached

Below there are several additional
tests of the default/null values behavior
both inside and outside functions.
Some results looks strange.

1) With lists
(i) in a script

nulldata 1
list znull = null
isznull = exists(znull)
nznull = nelem(znull)
print isznull nznull

(ii) inside a function

function void listtestfun (scalar x, list z[null])
isz = exists(z)
nz = nelem(z)
print isz nz
end function

listtestfun(1)
We have

isznull = 1.0000000
nznull = 0.0000000

and
isz = 1.0000000
nz = 0.0000000

as expected

2) with strings
(i) in a script

string snull = null
issnull = exists(snull)
nsnull = strlen(snull)
print issnull nsnull

The behavior is the same as for lists
and is as expected to be

Also,

emptycheck = snull==""
print emptycheck

We see that!
'string snull = null'
actually creates the "" string

(ii) inside a function

function void strtestfun (scalar x, string s[null])
iss = exists(s)
ns = strlen(s)
print iss ns
end function


strtestfun(1,"oleh")

OK!

strtestfun(1)

we have

The symbol 's' is undefined
*** error in function strtestfun, line 2

It seems now the problem is not
with exists() but is like this:
a function does not defines a string
variable in contrast as it does with
default null lists

3) catch string

function void testfun3 (scalar x, string s[null])
catch string s
err = $error
print err
end function


testfun3(1)

testfun3(1,"a")

Please, explain why we have "0" in the first
case and "2" in the second

Oleh
P.S.
inserted via libre office:


function void testfun2 (scalar x,
int n[1::1],
list z[null],
string ss[null])
isn = exists(n)
print isn
lss = strlen(ss)
print lss
isz = exists(z)
print isz
iss = exists(ss)
print iss
end function

nulldata 1

series z1 = 1
series z2 = 2
list zz = z1 z2

testfun2(1)
testfun(1,1)
testfun(1,1,z1)
testfun(1,1,zz)
testfun(1,1,zz,"a")

string sss = null
eval exists(sss)
eval strlen(sss)



list znull = null
isznull = exists(znull)
nznull = nelem(znull)
print isznull nznull


function void listtestfun (scalar x, list z[null])
isz = exists(z)
nz = nelem(z)
print isz nz
end function

listtestfun(1)

string snull = null
issnull = exists(snull)
nsnull = strlen(snull)
print issnull nsnull

emptycheck = snull==""
print emptycheck


function void strtestfun (scalar x, string s[null])
iss = exists(s)
ns = strlen(s)
print iss ns
end function

strtestfun(1)

strtestfun(1,"oleh")


string sss = null
catch string sss
err = $error
print err


string ssss = "a"
catch string ssss
err = $error
print err

function void testfun3 (scalar x, string s[null])
catch string s
err = $error
print err
end function


testfun3(1)

testfun3(1,"a")