"Sputnik" help  
Sputnik Help
WhereNot(<array>, <queryStm>)

Description

Filters elements in an array based on a specified query statement, returning elements that do not satisfy the query criteria.

Parameters

<array> The array to apply the filter.
<queryStm> The query statement to evaluate for each array element.

Return Value

Success: Returns a new array containing the elements that do not satisfy the query statement.
Failure: Returns an empty array if the input array is empty or if all elements meet the specified criteria.

Remarks

The WhereNot function is designed to filter elements in an array based on a specified query statement, returning elements that do not meet the criteria.

Make sure to read about the ->> and the =>> operators which are very often used in Linq statements.

Related

Example

Example of usage:

Class Person
{
    my $Name;
    my $Age;
    Function __Construct($Name, $Age)
    {
        @this->$Name = $Name;
        @this->$Age = $Age;
    }
}
my $people = array(
                new Person("Eddy", 25),
                new Person("Tom", 23),
                new Person("James", 17),
                new Person("Charles", 19),
                new Person("Mike", 27),
                new Person("Steve", 25),
                new Person("Steve", 35),
                new Person("James", 42),
                );
                
printr $people->>WhereNot($p => $p->$Age > 20);
printr $people->>WhereNot($p => $p->$Age > 20 && $p->$Name == "Steve");

// PRINTS
// Array
// (
//     [0] => person Class
//         (
//             [name] => James
//             [age] => 17
//         )
//     [1] => person Class
//         (
//             [name] => Charles
//             [age] => 19
//         )
// )
// Array
// (
//     [0] => person Class
//         (
//             [name] => Eddy
//             [age] => 25
//         )
//     [1] => person Class
//         (
//             [name] => Tom
//             [age] => 23
//         )
//     [2] => person Class
//         (
//             [name] => James
//             [age] => 17
//         )
//     [3] => person Class
//         (
//             [name] => Charles
//             [age] => 19
//         )
//     [4] => person Class
//         (
//             [name] => Mike
//             [age] => 27
//         )
//     [5] => person Class
//         (
//             [name] => James
//             [age] => 42
//         )
// )

 


Contact
Cheryl (uberfox@hotmail.com)
Homepage
http://ubersoft.org