Hi Charles
In my translation of JimKsmall basic i forund that in PowerBasic
he use function name as Returned value
do i can leave this way ?
i know that FUNCTION = 1 in O2 work
also as RETURN variable
as exemple i show you this:
FUNCTION LookUp(S AS STRING) AS INT
Dim Counter AS INT
Dim MyStr AS STRING
MyStr=S
Counter=1
MyStr=UCASE(MyStr)
LookUP=SB_UNKNCOM 'DEFAULT VALUE
While MID(Table[Counter].Command,1,1) <> "*" And Counter < SB_NUM_CMDS
If TRIM(Table[Counter].Command) = TRIM(MyStr) THEN
LookUp = Table[Counter].Tok
Counter = SB_NUM_CMDS
End If
Counter++ '+1
Wend
End FUNCTION
is that ok ..because looks to me that function not respond
or i must do something like that:
FUNCTION LookUp(S AS STRING) AS INT
Dim Counter AS INT
Dim MyStr AS STRING
MyStr=S
Counter=1
MyStr=UCASE(MyStr)
FUNCTION = SB_UNKNCOM 'DEFAULT VALUE
While MID(Table[Counter].Command,1,1) <> "*" And Counter < SB_NUM_CMDS
If TRIM(Table[Counter].Command) = TRIM(MyStr) THEN
FUNCTION = Table[Counter].Tok
Counter = SB_NUM_CMDS
End If
Counter=Counter+1
Wend
End FUNCTION