Up

varAdd

Add a global variable in the current environment.
An use can be a dynamic generation of source code such an source code editor

This function should be used by advanced developers only.

Prototype :

fun [S S S] I

Return : I 0 if success or nil if error.

See also :

varGet

varSet

Example

struct Client [
	cid = I,
	cname : S,
	cmail : S,
	cregister : S
	] mkClient;;

fun main ()=
	_showconsole;
	_fooId varAdd "varI" "I" "2";	// create varI, type = I, initial value = 2
	_fooId varAdd "varF" "F" nil;	// create varF, type = F, without initial value
	_fooId varAdd "myVarS" S "\"Hello !\"";	// create myVarS, type = S, initial value = "Hello"
	_fooId varAdd "varC" "Client" nil;	// create varC, type = Client, without initial value
	
	_fooId 3 + varGet "varI" nil;	// 5
	
	_fooS strcat "text is : " varSet "myVarS" "Hello World";
	0;;