I believe it doesn't have any special name. You're just accessing the first element of an array returned. In many languages there's nothing special in a function that returns an array.
In your case, you're not applying []
(indexing) operator to a function call. Instead, you apply it to the returned array. With precedence, it looks like this.
var firstElement = ( getSomeValues() )[0];
So there's nothing special in it.
However, there's another pattern of getting the first element, related to functional programming. For example:
($first_value, @rest_of_list) = getSomeValues(); # Perl
let first::rest = getSomeValues () in ... (* OCaml *)
This saves the first value of a list (technically, not of an array) into $first_value
, and the rest are stored in the array variable. That array variable may be omitted, and then you get the first value only.
($first_value) = getSomeValues(); # Perl
let first::_ = getSomeValues () in ... (* OCaml *)
The more generic concept, of which what shown above is just a special case, is pattern matching (more on pattern matching). In some functional languages (none of the shown above, but in Haskell, for example) it is different: it indeed only computes first element, and doesn't make the rest of list be evaluated.
However, there's nothing that could qualify as pattern matching at all in the procedural code you showed.