Lasso Soft Inc. > Home

[ void ]

Type

[void] is an an object which represents "not present" or "non-existant". This is used primarily for method return values. For example, [map->find] will return [void] when the object being searched for is not contained within the map. [void] is the default return value for a method which does not explicitly return anything. It is recommended that [void] only be used in method returns and in value comparison. To illustrate, inserting a void into a map would make it difficult to determine whether or not the value exists within the map.

[void] in Lasso has the following attributes.

  • void is always equal to itself
  • void is never equal to any other object type
  • void always reports a size of zero
  • Syntax
  • Methods
  • Traits
void
Has methods:
Has traits:
Examples
  • Beginner

This example shows how void is used to indicate "not found" when searching a map.

Code

local(mp = map('a'=1, 'b'=2, 'c'=null))

void == #mp->find('c') // yields false. 'c' was contained within the map

#mp->find('d') == void // yields true. 'd' was not contained within the map

Result

false
true

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft