How to say actions

Help Contents First Steps In Logo How to say actions
How to say words and lists How to say variables

How to say actions

Saying words and lists is as if you use only nouns in your everyday speech.

Only verbs are the means to express what you do with these things.

Traditionally Logo likes to see names of actions used directly.

If you want to print 5 and 6 you only need to order
	print 5 6. 
Many actions require the things it works with to be easy to find. That's why these things (called arguments or parameters) are usually written just before or after the name of the action.

When you define a new action you also define whether it will look for arguments before or after the name, or it will look in both places. For example, the action + expects one argument from the left side and one from the right.

To use already defined actions you need to know their names and where they expect their arguments to be placed.

If you fail to place them on the correct places some actions may fail too.

It is the right place now to explain the difference between arguments and parameters.

You can think of arguments as the things which are given to an action to use, while parameters are the things that an action expects.

In most cases arguments and parameters match.

Some actions can work with less or more arguments. If you are not sure how many parameters are expected, or you are sure that you provide more or less arguments, or, at last but not least, you want a better control of how Logo interprets your instructions, then you must frame the action and all its arguments in (...).

When Logo sees an action in parentheses it try to force the action to use all arguments.

In the following example you can see the action that is called first to be used in its standard way to extract the first letter of a word and print c, and later it is forced to work with two arguments (the second one is the number of letters to get from the heading of the word) and ... voila .. it prints ca.
	print first "cat
	print (first "cat 2)
	print first "cat 2
The third instruction will print c 2, because the number will be processed by print, because Logo has no clue that it must be used by first.

So, the general rule for saying an action is to write:

arg arg ... action_name arg arg...

If you want to explicitly set which arguments are given to an action, then use (...) in this way:

(arg arg ... action_name arg arg...)

You've seen that doing actions is quite a powerful activity.

Everything that Logo does is done in the form of actions.

That's why for clarity we will use other, more specific words for different types of actions.

Actions that are not supposed to calculate and return results will be called instructions or commands.

Actions that calculate and return results will be called functions.

Functions that expects arguments from both sides or from the left will be called operators.

Actions which arguments contain other acitions are often referred as expressions.

Anyway, do not make efforts to learn these terms by heart, because this classification of different types of actions is quite relative and is not formal at all.

All you need to know is that instructions, commands, functions, operators, expressions (and a bunch of other words) are all different flavors of actions.

How to say words and lists How to say variables