Export (0) Print
Expand All
Expand Minimize

Array.isEmpty<'T> Function (F#)

Tests whether an array is empty.

Namespace/Module Path: Microsoft.FSharp.Collections.Array

Assembly: FSharp.Core (in FSharp.Core.dll)

// Signature:
Array.isEmpty : 'T [] -> bool

// Usage:
Array.isEmpty array

array

Type: 'T []

The input array.

true if the array is empty. Otherwise, returns false.

This function is named IsEmpty in compiled assemblies. If you are accessing the function from a language other than F#, or through reflection, use this name.

The following code shows how to use Array.isEmpty.


let printArray array1 = 
    if (Array.isEmpty array1) then
        printfn "There are no elements in this array."
    else
        printfn "This array contains the following elements:"
        Array.iter (fun elem -> printf "%A " elem) array1
        printfn ""
printArray [| "test1"; "test2" |]
printArray [| |]


Output

This array contains the following elements:
"test1" "test2" 
There are no elements in this array.

Windows 7, Windows Vista SP2, Windows XP SP3, Windows XP x64 SP2, Windows Server 2008 R2, Windows Server 2008 SP2, Windows Server 2003 SP2

F# Runtime

Supported in: 2.0, 4.0

Silverlight

Supported in: 3

Community Additions

ADD
Show:
© 2015 Microsoft