Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

Operations on Vectors [2/13]

The getter function .mul from type vector2D multiplies a vector by a number. The number is given as the argument.

A vector is multiplied by multiplying all its coordinate components.

The multiplication operation multiplies the vector's length.

Points cannot be multiplied by a number, because such an operation has no sense. Therefore, the type point2D does not have a getter function .mul.

The getter function .mul is a pure function. Pure functions don't change anything, they just return a value.

Loading...