type, subtype

Prev Next

Function Names

type, subtype

Description

The function type returns one of the following string values:

  • numeral
  • string
  • boolean
  • date
  • parameter set
  • void

The function subtype returns one of the following string values:

  • numeral (contains an original text representation)
  • plain numeral (contains no text representation)
  • softquoted string, (softquoted string)
  • quoted string (quoted string)
  • boolean
  • date (contains an original text representation)
  • plain date (contains no text representation)
  • parameter set
  • void

Call as: function

Restrictions

Indirect parameter passing is disabled

Parameter count

1

Parameters

No.TypeDescription
1
input
all types Value

Value to be converted as described above.

Return value

TypeDescription
string Type of value

See main function desription

Examples

      a[num 1] = 1;
      a[num 2] = a[num 1] + 0;
      a[lit 1] = Plain text;
      a[lit 2] = 'A softquoted string';
      a[lit 3] = "A quoted string";
      a[lit 4] = soft( a[lit 3] );
      a[date] = date(today);
      a[bool] = true;
      a[pset] = { 1,2,3 };
      a[void] = null();

      for all variables( a[], value[], counter[], name[] )
      {
          echo( name[], ": ", value[], " --> ", type( value[] ), ", ", subtype( value[] ) );
      }

Output

bool: true --> boolean, boolean
date: 2024-07-14 --> date, plain date
lit 1: Plain text --> string, softquoted string
lit 2: A softquoted string --> string, softquoted string
lit 3: A quoted string --> string, quoted string
lit 4: A quoted string --> string, softquoted string
num 1: 1 --> numeral, numeral
num 2: 1 --> numeral, plain numeral
pset: {1,2,3} --> parameter set, parameter set
void: # Invalid Value # --> void, void
Try it yourself: Open LIB_Function_type.b4p in B4P_Examples.zip. Decompress before use.