§15.20. Multiplication of units
To recap, then, it is forbidden to multiply 122kg and 10kg, not because it could never make sense (a scientist might occasionally multiply two weights) but because the result is - what? Not a number, and not a weight any more. But we are allowed to tell Inform what the result ought to be, and once we have done so, the multiplication will be allowed:
A length is a kind of value. 10m specifies a length. An area is a kind of value. 10 sq m specifies an area.
A length times a length specifies an area.
The balance platform is in the Weighbridge. "The balance platform is 10m by 8m, giving it an area of [10m multiplied by 8m]."
which will turn up as:
The balance platform is 10m by 8m, giving it an area of 80 sq m.
And having told Inform that lengths multiply to area, we could also divide an area by a length to get a length: no further instructions would be needed.
The built-in "Metric Units" extension includes all of the standard ways that physical quantities are multiplied, and a good way to see these is to try out one of the Metric Units examples and look at the Kinds index, which includes a table showing how all of this works.
![]() | Start of Chapter 15: Numbers and Equations |
![]() | Back to §15.19. Arithmetic with units |
![]() | Onward to Chapter 16: Tables: §16.1. Laying out tables |
|
When we make a new kind of value, the new named values can themselves have properties. That is convenient because, for instance, we might want to associate a material (itself the property of an object) with certain features, such as price.
|
|
When we make a new kind of value, the new named values can themselves have properties. That is convenient because, for instance, we might want to associate a material (itself the property of an object) with certain features, such as price.
When we make a new kind of value, the new named values can themselves have properties. That is convenient because, for instance, we might want to associate a material (itself the property of an object) with certain features, such as price.
|
|