beautypg.com

1 multiple statements on one line, 2 one statement on multiple lines, 4 single-line declarations – Campbell Scientific CR1000 Measurement and Control System User Manual

Page 115: 1 variables

background image

Section 7. Installation

115

 

operator is located in the Help files of CRBasic Editor, which is included with
LoggerNet, PC400, and RTDAQ datalogger support software suites.

7.7.3.3.1 Multiple Statements on One Line

Multiple short statements can be placed on a single text line if they are separated
with a colon. This is a convenient feature in some programs. However, in
general, programs that confine text lines to single statements are easier for
humans to read.

In most cases, regarding statements separated by : as being separate lines is safe.
However, in the case of an implied EndIf, CRBasic behaves in what may be an
unexpected manner. In the case of an If...Then...Else...EndIf statement, where
the EndIf is only implied, it is implied after the last statement on the line. For
example:

If

A

then

B

:

C

:

D

does not mean:

If

A

then

B (implied

EndIf

) : C : D

Rather, it does mean:

If

A

then

B

:

C

:

D (implied

EndIf

)

7.7.3.3.2 One Statement on Multiple Lines

Long statements that overrun the CRBasic Editor page width can be continued on
the next line if the statement break includes a space and an underscore ( _). The
underscore must be the last character in a text line, other than additional white
space. A line continuation allows a CRBasic statement (executable line of text) to
span more than one file line.

Note CRBasic statements are limited to 512 characters, whether or not a line
continuation is used.

Examples:

Public

A, B, _

C,D, E, F

If

(A

And

B) _

Or

(C

And

D) _

Or

(E

And

F)

then

ExitScan

7.7.3.4 Single-Line Declarations

Public, Dim, and ReadOnly variables are declared at the beginning of a CRBasic
program, as are Constants, Units, Aliases, StationNames, DataTables, and
Subroutines. Table Rules for Names

(p. 140)

lists declaration names and allowed

lengths.

7.7.3.4.1 Variables

A variable is a packet of memory given an alphanumeric name through which
pass measurements and processing results during program execution. Variables
are declared either as Public or Dim at the discretion of the programmer. Public