company logo

GlobalVariable :: exist - Does global variable exist

The function checks, whether a global variable exists or not. In order to avoid exceptions, the function might be called before calling functions remove() or create().

// fragment

  GlobalVariable  userName("userName");

  if ( !userName.exist() )

    userName.create(Value(""));

  userName.value() = "Paul";

Return value:  Success ( bool  )

The value is true when the function was executed successfully. Otherwise the value is set to false.

Implementation details

bool GlobalVariable  :: exist (  )

The function returns true, when a global variable with the name passed in sGlobalVariable exists and false, otherwise.

// fragment

  GlobalVariable  userName("userName");

  if ( !userName.exist() )

    userName.create(Value(""));

  userName.value() = "Paul";