Looks like fun, should work though, try:

if (!%variable) { return $null }

Although, this works fine for me:

alias custom {
var %usernfo = test
.echo 8 -s %usernfo
if (%usernfo == $null) { return - $null }
else { return %usernfo }
}

//echo -> $custom

Although if its 'return' then the echo after the == $null line wouldnt be echo'd anyway.. check that too.. although If something dodgy is going on and it doesnt work, might want to check there isnt another alias with the same name somewhere (Older Version).. failing that, try using /set not /var.

Eamonn.