Contact an Expert

Why does VWRITE data_ary (2+3),1,2 generate an error? Yet, VWRITE data_ary does not create an error.

VWRITE variable-array-array_element (expression),data,data is not allowed for several reasons:

  • The 3852A ignores spaces and commas. So the line: VWRITE looks like: VWRITE(5).
  • VWRITE can be used to write to a single element in an array. For example: VWRITE array_name(1).
  • The parenthesis are necessary to distinguish between:

VWRITE array_name +1,+2,-1

which looks like

VWRITE array_name +1+2-1

  • VREAD only allows a single parameter to follow so it knows to evaluate the expression without parentheses. For example, VREAD will return 5.

Some more examples:

VWRITE array_name (2+3),4,5 ! generates an error

VWRITE array_name (2+3),4 ! sets array_name(5)=4

VWRITE array_name 4,(2+3),6 ! sets array_name(0)=4

! sets array_name(1)=5

! sets array_name(2)=6

VWRITE array_name +2+3+1 ! sets array_name(0)=2

! sets array_name(1)=3

! sets array_name(2)=1

VREAD 2+3+1 ! returns the value 6