Top
Back: 5.2.6 for
Forward: 5.2.8 keepring
FastBack: 5 Functions and system variables
FastForward: 6 Tricks and pitfalls
Up: 5.2 Control structures
Top: 1 Preface
Contents: Table of Contents
Index: F Index
About: About This Document

5.2.7 if

Syntax:

if ( boolean_expression ) true_block
if ( boolean_expression ) true_block else false_block

Purpose:

executes true_block if the boolean condition is true. If the if statement is followed by an else statement and the boolean condition is false, then false_block is executed.

Example:
int i = 9;
matrix m[i][i];
if (i > 5 and typeof(m) == "matrix")
{
  m[i][i] = i;
}

See Control structures; boolean expressions; break; else.


Top Back: 5.2.6 for Forward: 5.2.8 keepring FastBack: 5 Functions and system variables FastForward: 6 Tricks and pitfalls Up: 5.2 Control structures Top: 1 Preface Contents: Table of Contents Index: F Index About: About This Document
            User manual for Singular version 2-0-4, October 2002, generated by texinfo.