UseDefault (GenericNamedArraylist property)

From m204wiki
Revision as of 16:57, 30 September 2016 by Alan (talk | contribs) (minor spelling correction)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Flag indicating whether or not Item returns the Default value when name has no value (FloatNamedArraylist, NamedArraylist, and UnicodeNamedArraylist classes)

Flag is a ReadWrite property indicates whether an attempted retrieval of an item that is not in the FloatNamedArraylist, NamedArraylist, or UnicodeNamedArraylist should result in request cancellation of return the Default property value.

Syntax

%currentBoolean = anyNal:UseDefault anyNal:UseDefault = newBoolean

Syntax terms

%currentBoolean A declared enumeration object of type Boolean into which the current value (True or False) will be returned.
anyNal A FloatNamedArraylist, NamedArraylist, or UnicodeNamedArraylist object.
newBoolean A boolean literal or declared enumeration, to set the new value of UseDefault property.

Usage Notes

  • UseDefault will return, or may be assigned, only the boolean values True or False. Its initial, default value is False.

Examples

Given the following fragment:

%nal is namedArraylist of string len 30 %nal = new %nal('Akron') = 'Rubber City' %nal('Atlanta') = 'The Athens of the South' %nal('Philadelphia') = 'City of Brotherly love' print %nal('Philadelphia') with '!' %nal:useDefault = true print %nal('Boston') with '!' %nal:useDefault = false print %nal('Boston') with '!'

The result is:

City of Brotherly love! ! *** 1 CANCELLING REQUEST: MSIR.0751: Class NamedArraylist, property Item: ItemNotPresent exception: item not present in line ...

Notice that the first print %nal('Boston') outputs the null string (the default value for the string len 30 item type) because of the preceding %nal:useDefault = true, but then when set to false the same item invocation cancels the request.

See also