WRITE INDEX

WRITE _ _ _ _ _ _ _ _ _ _ _ _ command

The write command explicitly writes its arguments to the output device (terminal or file).

syntax:

write<item>{,<item>}*

<item> can be an expression, an assignment or a string enclosed in double quotation marks (").

examples:


write a, sin x, "this is a string"; 


  ASIN(X)this is a string 


write a," ",sin x," this is a string"; 


  A SIN(X) this is a string 


if not numberp(a) then write "the symbol ",a;
							


  the symbol A 


array m(10); 

for i := 1:5 do write m(i) := 2*i; 


  M(1) := 2
  M(2) := 4
  M(3) := 6
  M(4) := 8
  M(5) := 10


m(4); 

  8

The items specified by a single write statement print on a single line unless they are too long. A printed line is always ended with a carriage return, so the next item printed starts a new line.

When an assignment statement is printed, the assignment is also made. This allows you to get feedback on filling slots in an array with a for statement, as shown in the last example above.