Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
is ther any possibility to declare an own Sub like:
sub isACoolName(name)
//return -1 or 0
Endsub
and then use it in if expressions: if isACoolName('JanUlrich') then .... ??
and how does such an return statemant have to look like?
MFG
Hi,
Try this.
sub isACoolName(name)
isACoolName =1
Endsub
Regards,
Kaushik Solanki
okey, thanks. But i still got a problem with writing the return value into a variable or use it in another way.
things like this:
a = isACoolName('test');
ora = call isACoolName("test");
dont seem to work.
thanks for your input!
Hi,
You can't return values from subroutines. You might like try using a $-sign expansion, though. e.g.
SET isACoolName=('$1'='janulrich');
LET a=$(isACoolName('John'));
Managing return values from SUB are possible in this way:
1) define a INLINE table VAR - it is used like a collection in VB or JavaScript
VAR:
LOAD * INLINE [ Name, Val, Dummy_Var, 42 ]
2) create service functions to add or delete records in VAR
return values in SUBs can be stored in VAR with an Var_Add() or you can store directly with an LOAD * INLINE
Name, Val, ReturnVal, $(xyValue)
3) in main-pgm use LOOKUP to read the content of the Variable
Disadventages:
- initial effort to create service routines
- not very transparent
Adventage:
- array() are possible
- unlimited record structure as you can create more fields in VAR Inline
- the INLINE table is a normal table which can be used in your app to display your VAR-records
Ralf