Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
Add documentation for Array.head (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSchierboom authored and cartermp committed Mar 13, 2017
1 parent d88b443 commit 9690704
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
68 changes: 68 additions & 0 deletions docs/conceptual/array.head['t]-function-[fsharp].md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
title: Array.head<'T> Function (F#)
description: Array.head<'T> Function (F#)
keywords: visual f#, f#, functional programming
author: erikschierboom
manager: danielfe
ms.date: 03/12/2017
ms.topic: language-reference
ms.prod: visual-studio-dev14
ms.technology: devlang-fsharp
ms.assetid: 3c376852-11f0-4286-9210-6d8a719ae626
---

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

Returns the first element of the array.

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

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


## Syntax

```fsharp
// Signature:
Array.head : 'T[] -> 'T
// Usage:
Array.head array
```

#### Parameters
*array*
Type: **'T**[[]](https://msdn.microsoft.com/library/def20292-9aae-4596-9275-b94e594f8493)


The input array.

## Exceptions

|Exception|Condition|
|----|----|
|[ArgumentException](https://msdn.microsoft.com/library/system.argumentexception.aspx)|Thrown when the array is empty.|

## Return Value

The first element of the array.

## Remarks
Raises `System.ArgumentException` if *array* is empty

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

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


## Version Information
**F# Core Library Versions**

Supported in: 4.0, Portable


## See Also
[Collections.Array Module &#40;F&#35;&#41;](Collections.Array-Module-%5BFSharp%5D.md)

[Microsoft.FSharp.Collections Namespace &#40;F&#35;&#41;](Microsoft.FSharp.Collections-Namespace-%5BFSharp%5D.md)
1 change: 1 addition & 0 deletions docs/conceptual/collections.array-module-[fsharp].md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ For an overview of arrays in F#, see [Arrays &#40;F&#35;&#41;](Arrays-%5BFSharp%
|[`foldBack2`](https://msdn.microsoft.com/library/aa51b405-df20-4c51-9998-a6530f7db862)<br />**: ('T1 -&gt; 'T2 -&gt; 'State -&gt; 'State) -&gt; 'T1 [] -&gt; 'T2 [] -&gt; 'State -&gt; 'State**|Applies a function to pairs of elements from two supplied arrays, right-to-left, threading an accumulator argument through the computation. The two input arrays must have the same lengths; otherwise, **System.ArgumentException** is raised.|
|[`forall`](https://msdn.microsoft.com/library/d88f2cd0-fa7f-45cf-ac15-31eae9086cc4)<br />**: ('T -&gt; bool) -&gt; 'T [] -&gt; bool**|Tests whether all elements of an array satisfy the supplied condition.|
|[`forall2`](https://msdn.microsoft.com/library/c68f61a1-030c-4024-b705-c4768b6c96b9)<br />**: ('T1 -&gt; 'T2 -&gt; bool) -&gt; 'T1 [] -&gt; 'T2 [] -&gt; bool**|Tests whether all corresponding elements of two supplied arrays satisfy a supplied condition.|
|[head](https://msdn.microsoft.com/library/3c376852-11f0-4286-9210-6d8a719ae626)<br />**: 'T [] -&gt; 'T**|Returns the first element of the array.|
|[`get`](https://msdn.microsoft.com/library/dd93e85d-7e80-4d76-8de0-b6d45bcf07bc)<br />**: 'T [] -&gt; int -&gt; 'T**|Gets an element from an array.|
|[`init`](https://msdn.microsoft.com/library/ee898089-63b0-40aa-910c-5ae7e32f6665)<br />**: int -&gt; (int -&gt; 'T) -&gt; 'T []**|Uses a supplied function to create an array of the supplied dimension.|
|[`isEmpty`](https://msdn.microsoft.com/library/c2bd48e9-8aba-4bea-ad84-17352886d3a8)<br />**: 'T [] -&gt; bool**|Tests whether an array has any elements.|
Expand Down

0 comments on commit 9690704

Please sign in to comment.