This chapter covers the rudiments of command structures in M, using assignment and I/O statements (SET, KILL, READ, WRITE) as examples. The material is quite straightforward, although M does attach a syntactical significance to spaces that is not found in most other languages. In addition, the special forms of some of these commands might bear review. The summary at the end of the chapter, together with a review of the exercises, should tell the experienced reader if more detailed review is needed.
In the preceding chapters we learned some elements of the vocabulary of M, including operators, variables, and a few functions. Implicit in some of the material already covered was some introduction to the syntax of the language. Chapter 3 gave you enough information on M syntax to allow you to complete the examples in the early part of this text. In this chapter we will focus more on syntax, considering the concept of an M command and how that language element is used with the operators, variables, and functions described in previous sections. At the end of this chapter you will be ready to start writing complete M statements, and you will be well on your way to programming in M.
What is a command?
Consider the following three English sentences:
1.
Stop.
2.
Open the door.
3.
Put the book on the table.
Each sentence is a command,...
Copyright Butterworth-Heinemann 1997 under license agreement with Books24x7