In this shot, we will learn about Julia’s built-in any()
function.
The any()
function is a built-in function provided by Julia.
It tests whether any element in the Boolean collection has a true
value.
We use the following syntax for this function.
any(boolean_collection)
The any()
function takes a boolean collection as a parameter.
true
.missing
.false
.Let’s use an example to understand it better:
In the following code, we have three examples for three cases as specified in the returns above:
#Refer to point 1 in returnsprintln(any([false, false, true, false]))#Refer to point 2 in returnsprintln(any([false, missing, false]))#Refer to point 3 in returnsprintln(any([false, false, false, false]))
Let’s take a small quiz on what we have learned about the any()
function so far.
Let’s check our understanding of the any()
function in Julia.
What do you think the below code snippet prints?
println(any([false, missing, true]))
true
false
missing