Singular

Home Online Manual
Top
Back: mult
Forward: names
FastBack: Functions and system variables
FastForward: Control structures
Up: Functions
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

5.1.95 nameof

Syntax:
nameof ( expression )
Type:
string
Purpose:
returns the name of an expression as string.
Example:
 
  int i=9;
  string s=nameof(i);
  s;
==> i
  nameof(s);
==> s
  nameof(i+1); //returns the empty string:
==> 
  nameof(basering);
==> basering
  basering;
==>    ? `basering` is undefined
==>    ? error occurred in or before ./examples/nameof.sing line 7: `  baseri\
   ng;`
  ring r;
  nameof(basering);
==> r
See names; reservedName; typeof.