Tip 92. Dimensional one-line-program

Fig. 92. Dimensional one-line-program

The program-function shown in previous tip in the fig. 91 has one disadvantage: it can not work with dimensional arguments as since the matrix written on single program line can keep only non-dimensional values or equidimensional values. But in our case when we call the function the local variables have different dimension: length, square and volume. The solution of this problem is showed in the fig. 92: the variables of the program are deprived of their dimension owing to division by base unit of its dimension (in our case it is unit meter m). In the fig. 92 there is not one but two functions with the name V: the first is debugging one its style is Local Vars and Funcs, the second is working function its style is Variable: it withdraws necessary element from the matrix and multiply it by necessary unit of measure by cubic meter. Our technology of creation users function with help of intermediate debugging function has one more advantage: additional control of correct dimension of the arguments is leaded in the program (see also tip 21 and tip 61).

Fig. 92a. On-line-function with alternative

Evolution of the problem about calculation of the volume of a cone is showed in the fig. 92: for control the right of the ratio between the arguments the function if is inputted in it: the radius of a cone can not be more than the cone generator. Textual message Yes or No appears in the matrix of the returnable function the answer the alternative question of commentary (Is everything all right?).