Hello,

Did someone know how to convert an **int Array** value to an **int** value?

For example:

let n = [|3|];;

Hello,

Did someone know how to convert an **int Array** value to an **int** value?

For example:

let n = [|3|];;

1 Like

I assume you would like to define this conversion for arrays with a single element:

```
let int_of_single_element_array = function
| [| i |] -> Some i
| _ -> None
;;
```

Note that since the function is partial (not defined for any array), I used an option type for the result.

Hope this helps,

ph.

2 Likes

Thank you!