MPE/iX Shell and Utilities Reference Manual, Vol 1

bc(1) MPE/iX Shell and Utilities bc(1)
Comments and White Space
A comment has the form
/* Any string */
Comments can extend over more than one line of text. When bc sees /* at the start of a com-
ment, it discards everything up to the next */. The only effect a comment has is to indicate
the end of a token.
As an extension, this version of bc also provides an additional comment convention using the
# character. All text from the # to the end of the current line is treated as a single blank, as in
2+2 # this is a comment
bc is free format. You may freely insert blanks or horizontal tab characters to improve the
readability of the code. Instructions are assumed to end at the end of the line. If you have an
instruction that is so long you need to continue it onto a new line, put a backslash (\) as the
last character of the first line and continue the instruction on the next line. For example,
a=2\
+3
This is equivalent to
a=2+3
Instructions
A bc instruction may be an expression that performs a calculation, an assignment, a function
definition, or a statement. If an instruction is not an assignment, bc displays the result of the
instruction when it has completed the calculation. For example, if you enter
3.14 * 23
bc displays the result of the calculation. However, with
a=3.14*23
bc does not display anything because the expression is an assignment. If you do want to dis-
play the value of an assignment expression, place the expression in parentheses.
The following list shows the instruction formats recognized by bc.
expression
calculates the value of the expression.
1-52 Commands and Utilities