Lasso Soft Inc. > Home

[ staticarray->contains ]

Method

The [staticarray->contains] method returns true if the method's parameter is contained in the array or false otherwise.

This tag performs the same operation as the contains symbol >> with a staticarray on the left-hand side.

  • Syntax
if( staticarray->contains( element ) ) => {   } 
Examples
  • Beginner

Determine if a staticarray contains a particular value

In this example we check to see if a particular name is in an array of names.

Code

var(myNames = staticarray('Sean', 'Jono', 'Jess', 'Eric', 'Kyle'))

//test for Jess
if( $myNames->contains('Jess') ) => {^
     'Jess is in the list'
else
     'Jess is not in the list'
^}

Result

Jess is in the list

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