Code: Select all
declare sub ValidateLeadingSign(Digit as string,MinusExists as Byte)
dim shared as string TxtLine
'Validate unairy + or - sign for number
Digit as string,_
Byval MinusExists as Byte)
Digit = "no negative"
if TxtLine = "-" then
print "before MinusExists = ";MinusExists
MinusExists = not MinusExists
print "after MinusExists = ";MinusExists
Digit = "Found negative"
Dim Digit as string
Dim MinusExists as Byte
MinusExists = 1
TxtLine = "-"
Print "value of MinusExists =";MinusExists
If MinusExists then
Print "error a floating point hex number MUST be unsigned."
The way the code is currently written MinusExists changes its value in the subroutine but never passes it back.
I tried to do it by changing the "byval" to "byref" but get a type mismatch error. How do I change my code to pass back
MinusExists with its value changed? The only other way I got it to work was to have MinusExists be a shared variable.