Table of contents
Collapse the table of content
Expand the table of content

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

Den Delimarsky|Last Updated: 8/18/2017
1 Contributor

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.

Return Value

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."
        printfn "This array contains the following elements:"
        Array.iter (fun elem -> printf "%A " elem) array1
        printfn ""
printArray [| "test1"; "test2" |]
printArray [| |]


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


Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2

Version Information

F# Core Library Versions

Supported in: 2.0, 4.0, Portable

See Also

Collections.Array Module (F#)

Microsoft.FSharp.Collections Namespace (F#)

© 2020 Microsoft