Function Naming

Prev Next

Introduction

B4P function names must be formulated plain text and may consist of multiple words with spaces inbetween and allow special characters as long they do not interfere with the B4P syntax (For example single points ( . ) and underscore symbols (_) are OK). This makes function names easy to read and memorize, for example table lookup ignore case(). Quotation marks (e.g. to force up multiple consecutive spaces in function names) are not allowed.

Please note the following rules for function names, especially when creating user-defined procedures and user-defined functions on your own:

  • Function names are case sensitive
  • Function names are always specified as plain text, i.e. always without quotation marks
    • Multiple words sparated with spaces are allowed
    • Multiple spaces and tabs are interpreted as one single space
    • Special symbols may be used as long they do not interfere with the B4P syntax. Example: single points ( . ) and underscore symbols (_) are OK, but the hypen (minus sign) is not.
  • Function names do not interfere with variable names and table names, i.e. table and variable names 'echo' are allowed like in this valid example:
    echo( echo[], [echo:1,2] );

Function Naming Examples

The first two function names listed below are equivalent, but all the remaining ones are not.

Function call Explanation
table process(...) Calls table process() which is a valid function in this B4P library
  table   process  (...); Same function as above: Multiple spaces collapse to 1 space, leading and trailing spaces are ignored
Table process(...) Function names are case sensitive. This is a different funtion name.
table_process(...) Snake-case formulation: Underscore and other symbols differ from spaces.
table-process(...) Attention: Kebab-case does not work. It attempts to execute 'process(...)', then do a text subtraction of 'table' minus return value of process(...).
tableprocess(...) Single-word 'tableprocess' differs from double-word 'table process'
TableProcess(...) Camel case formulation: Capitalized letter for each word makes it a distinct function name from 'tableprocess'
'table process'(...) Syntax error (only plain text is allowed)
"table process"(...) Syntax error (see above)