previous  next
4.1.2. Setting Options
Each option name is unique, not just among the options in a
particular panel, but among the options from all panels.  The command
'Set' followed by an option name (without parentheses or quotes) sets
the corresponding option to TRUE.  Similarly, 'Unset' sets the option
to FALSE.  In addition, one may use the 'Set' command to set an option
either true or false using the syntax: 'Set option-name := TRUE' or
'Set option-name := TRUE'. 

Example

Use R ::= Q[x,y,z];
L := [(x+y)^N | N In 1..3];
Set Indentation;  -- print each component on a separate line
L;
L;
[
  x + y,
  x^2 + 2xy + y^2,
  x^3 + 3x^2y + 3xy^2 + y^3]
-------------------------------
Unset Indentation;


The function 'Option' takes as parameter an option name and
returns the (boolean) value of the option.  It is particularly useful
within user-defined functions as illustrated in the example below:

Example

Define Print_UnIndented(X)
  Opt := Option(Indentation);
  Unset Indentation;
  Print(X);
  Set Indentation := Opt;
EndDefine;

R := Record[X='test',L=[1,2,3]];
Set Indentation;
Print_UnIndented(R);
Record[L = [1, 2, 3], X = "test"]
-------------------------------
UnSet Indentation;
Print_UnIndented(R);
Record[L = [1, 2, 3], X = "test"]
-------------------------------