The Wayback Machine - https://web.archive.org/web/20230522043032/https://www.geeksforgeeks.org/checking-for-true-values-in-an-array-in-julia-any-and-all-methods/
Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Checking for true values in an array in Julia – any() and all() Methods

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

The any() is an inbuilt function in julia which is used to test whether any elements of the specified boolean collection are true and if any of the input value is ‘missing’, it will return missing if all non-missing values are false.

Syntax: any(itr)

Parameters:

  • itr: Specified boolean collection.

Returns: It returns true if any of the value of specified boolean collection is true. And also return missing value if all non-missing values are false in the boolean collection.

Example 1:




# Julia program to illustrate 
# the use of any() method
  
# Getting true if any of the value 
# of specified boolean collection is
# true. And also return missing value 
# if all non-missing values are false
# in the boolean collection.
println(any([true, false, true, false]))
println(any([true, true, true, true]))
println(any([false, false, false, false]))
println(any([missing, true, true]))
println(any([false, missing, true]))
println(any([false, missing, false]))

Output:

all()

all() is an inbuilt function in julia which is used to test whether any elements of the specified boolean collection are true and if any of the input value is ‘missing’, it will return missing if all non-missing values are true.

Syntax:
all(itr)

Parameters:

  • itr: Specified boolean collection.

Returns: It returns false if any of the value of specified boolean collection is false. And also return missing value if all non-missing values are true in the boolean collection.

Example 1:




# Julia program to illustrate 
# the use of all() method
  
# Getting false if any of the value 
# of specified boolean collection is
# false. And also return missing value 
# if all non-missing values are true
# in the boolean collection.
println(all([true, false, true, false]))
println(all([true, true, true, true]))
println(all([false, false, false, false]))
println(all([missing, true, true]))
println(all([false, missing, true]))
println(all([false, missing, false]))

Output:


My Personal Notes arrow_drop_up
Last Updated : 26 Mar, 2020
Like Article
Save Article
Similar Reads