ЭЛЕКТРОННАЯ БИБЛИОТЕКА КОАПП |
Сборники Художественной, Технической, Справочной, Английской, Нормативной, Исторической, и др. литературы. |
3.5 Scalar and List ContextAs you can see, each operator and function is designed to operate on some specified combination of scalars or lists, and returns either a scalar or a list. If an operator or function expects an operand to be a scalar, we say that the operand or argument is being evaluated in a scalar context. Similarly, if an operand or argument is expected to be a list value, we say that it is being evaluated in a list context. Normally, this is fairly insignificant. But sometimes you get completely different behavior depending on whether you are within a scalar or a list context. For example, A scalar value used within a list context is promoted to a single-element array. |