Formula Syntax
Spaces and Blank Lines
"Same Line" Rule
Variable Usage
Comments
Invalid Characters
Switch/Case
Bracket Counts
Spaces and Blank Lines |
Spaces are totally irrelevant to the formula.
You can use as many or as few spaces as you wish.
Also, you may have blank lines to help visually separate items.
These are all the same, just with different spacing
x=2*4
x = 2 * 4
x = 2 * 4
|
|
"Same Line" Rule |
Each calculation must be on the same line.
Take note that the formula editor will wrap long lines around to the next line.
This does not effect the "same line" rule.
This is Okay
x = 2 * (4 * 8)
This is Bad
x = 2 *
(4 * 8)
|
|
Variable Usage |
Variables should always be set before used.
You can not assume that a variable will return a value of 0.
Variables that are used before they are set will return NULL.
This is not the same as 0 and will cause the formula output to be less than desirable.
This is Okay
myvar = 0
x = myvar + 8
This is Bad
x = myvar + 8
|
|
Comments |
Use a semicolon to denote a comment.
Comments can be an entire line or at the end of a line.
Once a semicolon is placed, from that point to the end of the line is ignored by the formula.
;This whole line is a comment
x = 1 + 2 + 3 ;Everything after the semicolon is a comment
|
|
Invalid Characters |
Many characters can cause a syntax error.
These errors will cause your formula to not be processed.
You will be notified of these types of errors.
These Are Invalid Characters
! @ # $ % ^ & _ ` | \ : ' < > ? "
|
|
Switch/Case |
Only one Switch/Case at a time can be processed.
A formula may have as many Switch/Cases as you wish, but only one can be processed at a time.
This is Okay
Switch[ first ] {
Case[ 0, 1 ] {
}
}
Switch[ second ] {
Case[ 0, 1 ] {
}
}
This is Bad
Switch[ first ] {
Case[ 0, 1 ] {
Switch[ second ] {
Case[ 0, 1 ] {
}
}
}
}
|
|
Bracket Counts |
It is very important that you have a closing bracket for an opening bracket.
These errors will cause your formula to not be processed.
You will be notified of these types of errors.
This is Okay
x = sin[ Pi ] * ( 3 + 6 )
These are Bad
x = sin[ Pi * ( 3 + 6 )
x = sin[ Pi ] * ( 3 + 6
x = sin[ Pi ] * 3 + 6 )
|
|
|