Up |
varIf
Call a function if the type of the given function is the good.
This function should be used by advanced developers only.
Prototype :
fun [S S fun [u0] u1 u0] u1
- S : the name of the variable
- S : the "good" type (of course, it should be known in the current channel)
- fun [u0] u1 : the called function if the variable has the good type
- u0 : the parameter at your convenience for the function
Return : u1 the return value of the function (if called), nil else (not called or error).
See also
Example
fun ifVar (p)=
let p -> [arg nick] in
if !strcmp arg nick then
"Bob"
else
"Alice";;
fun anyFunction (arg)=
_showconsole;
_fooS strcat "name is " varIf "myVariable" "S" @ifVar [varGet "myVariable" nil "Bob"]; // Bob (or Alice)
0;;