I would like to use the Err function and statement to generate an error flag
and handle the error afterwards.
In the code below, I have set err to 1009 whenever an erroneous input is
received. However, this doesn't see to work, as err() always returns 0.
I don't want to use the On Error type handler.
Code: Select all
function repeatstr(s as string) as string
err = 0
if s = "a" then
err = 1009
end if
return s & s
end function
print "repeat = "; repeatstr("s")
print "error = "; err()
print "repeat = "; repeatstr("a")
print "error = "; err()
Code: Select all
repeat = ss
error = 0
repeat = aa
error = 0