Lasso Soft Inc. > Home

[ array->contains ]

Method

array->contains 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 an array on the left-hand side.

  • Syntax
if( array->contains(value) ) => { }
Examples
  • Beginner

Determine if an array contains a particular value

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

Code

var(myNames = array('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 2014 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft