Assign a value to a variable


Use variable assignment syntax to declare and assign a value to a new variable, or reassign a different value to an existing variable.


The variable assignment syntax consists of three things:

  • A variable name
  • An equals sign
  • The variable's value

Variable names begin with a dollar-sign $ and may be composed of alphabetic characters A-Z, a-z, numerals 0-9, and dashes -.

Values may be delimited with apostrophes ' ' or quotation-marks " "; both of these may be omitted when the value does not have any spaces.

$varname="variable value"
$varname='variable value'
Variable assignment

When a variable is assigned for the first time, its value is added to the BLUEPROCESSOR internal dictionary.

When a variable is reassigned, the internal dictionary's value is replaced with the new value.

When a variable name is typed into a manuscript (without assigning a value to it), its internal dictionary value is injected into the compiled document.

Other ways to use variable assignment

It's possible to assemble one or more variables into a new variable using an assignment like this.

$variable3="text3 $varname1 text4 $varname2 text5"
Assignment from existing variables

If a variable is going to be reassigned, it is possible to save its current value and restore it later by using a pair of assignments like this:



Saving and restoring a variable's value


Here is what variable assignment looks like within the body of a manuscript.

$TITLE="Palacio's Comeuppance"
$DESCRIPTION='A "fresh start" with a tired cliché'
Sample variable assignment

syntax > variables > assignmentAssign a value to a variable

🔗 🔎