I don't think you're checking the existance of an argument this way, but simply if it is zero. You can only use an argument optionally if you declare a default value:
function test(a=0)
But if you really want to test if an argument is used,you maybe have to set the default to a value that makes absolutely no sense and is completely unlikely to be used, eg:
function test(a=$FEFEFEFE)
if a=$FEFEFEFE then ; no argument was received
This example makes sense if the value will always be in a lower range. Right now I have no idea how to handle this savely if the entire 32 bit range should be usable.
function test(a=0)
But if you really want to test if an argument is used,you maybe have to set the default to a value that makes absolutely no sense and is completely unlikely to be used, eg:
function test(a=$FEFEFEFE)
if a=$FEFEFEFE then ; no argument was received
This example makes sense if the value will always be in a lower range. Right now I have no idea how to handle this savely if the entire 32 bit range should be usable.