# [I7] Can you make definitions from "to decide" values?

I have a situation where I want containers to add up the values of their contents. No problem, I can do that with a “to decide” phrase. But can I then somehow use that number in a definition?

So it’s similar to this:

``````a thing has a number called worth. The worth of a thing is usually 10.

to decide what number is the price of (chosen item - a thing):
decide on the worth of the chosen item.

to decide what number is the price of (chosen container - a container):
let total be the worth of the chosen container;
repeat with item running through the things in the chosen container:
increase total by the price of the item;
decide on total.

definition: a thing is valuable if its worth is 10 or more.``````

Of course I can do another “to decide” phrase (I just did) “to decide which thing is the most valuable in (L - a list of things)”, but what I would LIKE to do is define “a thing is valuable if its price is 10 or more”, but Inform does not seem to be capable of doing this.

Is there a way around this, to return to the land of definitions, or are you stuck in “to decide” land once you go there?

You’ve defined the phrase “the price of (x)”, but this does not enable Inform to understand “its price”. You need to use the phrase you defined.

The term “X or more” is a special case in comparison definitions. You want to make use of the general numerical comparison relation.

Thus:

``````definition: a thing is valuable if the price of it >= 10.

[or]

definition: a thing is valuable if the price of it is at least 10.

[or]

definition: a thing is valuable if the price of it is greater than 9.``````

Ok, thanks, of course!

But you still can’t use such a definition for comparisons, right? And you can’t use it when creating objects, but that is logical - “the box is valuable” only makes sense if it maps directly to a property, not when it refers to a calculated value.

So, if I am getting this right,

``Definition: a thing is valuable if its worth is 10 or more. ``

and

``Definition: a thing is valuable if the worth of it greater than 9.``

both work, but do different things: only the first one gives you an adjective that can be used for comparisons (using valuabler/valuablest).

And you can only use the first version when you are talking about a property, not a value that comes from a “to decide” phrase.

Right?

Right.

Er, as far as I know. I haven’t used the comparison feature much at all.