|
| Data type neutral variables |
| Iniciado por guest, 13,ene. 2015 12:30 - 3 respuestas |
| |
| | | |
|
| |
| Publicado el 13,enero 2015 - 12:30 |
Hello All,
I have observed that when we create Procedures we can declare Variable (as Parameters) without any data type like for example: PROCEDURE MyProper(LOCAL MyStr, LOCAL MyMode is boolean) But I am not able to declare variables in any Procedure without any data type associated with them!
So how can I declare variables that are Data Type neutral?
TIA
Yogi Yang |
| |
| |
| | | |
|
| | |
| |
| Publicado el 13,enero 2015 - 13:05 |
| variabeleNeutral is variant ? |
| |
| |
| | | |
|
| | |
| |
| Publicado el 13,enero 2015 - 22:30 |
Hi Yogi,
Use the keyword "Let"... This will type the variable based on the type that is being passed. Next you can test the type using the TypeVar() function.
E.g. (Out of my head - So untested): FUNCTION MyFunction(LET pAnyVariableType) //or FUNCTION MyFunction(LOCAL LET pAnyVariableType) SWITCH TypeVar(pAnyVariableType) CASE wlString: Info("String") CASE wlInt: Info("Integer") OTHER CASE: Info("Some other type") END Cheers,
Peter H. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 15,enero 2015 - 06:56 |
Thanks for the hint.
It means I will have to use Variant DataType for variables.
I will test it soon.
TIA
Yogi Yang |
| |
| |
| | | |
|
| | | | |
| | |
|