UseDefault (GenericNamedArraylist property): Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Created page with "<span style="font-size:120%; color:black"><b><section begin=dpl_desc/>Return the Default value?<section end=dpl_desc/></b></span> [[Category:NamedArraylist methods|UseDefault pro...")
 
m (minor spelling correction)
 
(15 intermediate revisions by 5 users not shown)
Line 1: Line 1:
<span style="font-size:120%; color:black"><b><section begin=dpl_desc/>Return the Default value?<section end=dpl_desc/></b></span>
{{Template:GenericNamedArraylist:UseDefault subtitle}}
[[Category:NamedArraylist methods|UseDefault property]]
<var>Flag</var> is a ReadWrite property indicates whether an attempted retrieval of an item that is not in the <var>[[FloatNamedArraylist class|FloatNamedArraylist]]</var>, <var>[[NamedArraylist class|NamedArraylist]]</var>, or <var>[[UnicodeNamedArraylist class|UnicodeNamedArraylist]]</var> should result in request cancellation of return the <var>[[Default (NamedArraylist property)|Default]]</var> property value.
<!--DPL?? Category:NamedArraylist methods|UseDefault property: Return the Default value?-->
<p>
UseDefault is a member of the [[NamedArraylist class]].
</p>
 
This ReadWrite property indicates whether an attempted retrieval of an item
that is not in the NamedArraylist should return the
[[Default (NamedArraylist property)|Default]] property value.


UseDefault will return, or may be assigned, only the
values <tt>True</tt> or <tt>False</tt>.
Its initial value is <tt>False</tt>.
==Syntax==
==Syntax==
  %bool = %namrayl:UseDefault
{{Template:GenericNamedArraylist:UseDefault syntax}}
===Syntax terms===
<table class="syntaxTable">
<tr><th>%currentBoolean</th>
<td>A declared enumeration object of type Boolean into which the current value (<code>True</code> or <code>False</code>)  will be returned.
<tr><th>anyNal</th>
<td>A <var>FloatNamedArraylist</var>, <var>NamedArraylist</var>, or <var>UnicodeNamedArraylist</var> object.</td></tr>
<tr><th>newBoolean</th>
<td>A boolean literal or declared enumeration, to set the new value of <var>UseDefault</var> property.</td></tr>
</table>


  %namrayl:UseDefault = %bool
==Usage Notes==
===Syntax Terms===
<ul><li><var>UseDefault</var> will return, or may be assigned, only the boolean values <code>True</code> or <code>False</code>.  Its initial, default value is <code>False</code>.
<dl>
</ul>
<dt><i>%bool</i>
==Examples==
<dd>A declared enumeration object of type Boolean to contain the returned
Given the following fragment:
or assigned value (<tt>True</tt> or <tt>False</tt>) of the UseDefault property.
<p class="code">%nal is namedArraylist of string len 30       
 
%nal = new                                   
For more information about these enumerations, see [[Using Boolean enumerations]].
%nal('Akron') = 'Rubber City'                 
<dt><i>%namrayl</i>
%nal('Atlanta') = 'The Athens of the South'   
<dd>A NamedArraylist object.
%nal('Philadelphia') = 'City of Brotherly love'
print %nal('Philadelphia') with '!'           
%nal:useDefault = true                       
print %nal('Boston') with '!'                 
%nal:useDefault = false                       
print %nal('Boston') with '!'                 
</p>
The result is:
<p class="output"><nowiki>
City of Brotherly love!                                                                                                       
!                                                                                                                             
***  1  CANCELLING REQUEST: MSIR.0751: Class NamedArraylist, property Item:
        ItemNotPresent exception: item not present in line ...
</nowiki></p>
Notice that the first <code>print %nal('Boston')</code> outputs the null string (the default value for the <code>string len 30</code> item type) because of the preceding <code>%nal:useDefault = true</code>, but then when set to <code>false</code> the same <code>item</code> invocation cancels the request.


</dl>
==See also==
<ul><li>For more information about these enumerations, see [[Enumerations#Using_Boolean_enumerations|"Using Boolean Enumerations"]].
</ul>
{{Template:GenericNamedArraylist:UseDefault footer}}

Latest revision as of 16:57, 30 September 2016

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