Skip to content
  • Home
  • Account
  • Restricted content
  • OBEX
  • Chips Tips
  • Logout
  • Shop
  • Blog
Propeller OBEX
  • OBEX
  • Forum
Login
Propeller OBEX
View Categories
  • Home
  • Docs
  • Spin Language Reference
  • Block Designators
  • VAR

VAR

Reading Time: 1 min read

Designator: Declare a Variable Block.

VAR
  Size Symbol < [Count ] > < Size Symbol < [Count ] >>...


VAR
  Size Symbol < [Count ] > < , Symbol < [Count ] >>...

  • Size is the desired size of the variable, BYTE, WORD or LONG.
  • Symbol is the desired name for the variable, and must be unique to the object.
  • Count is an optional expression, enclosed in brackets, that indicates this is an array variable, with Count number of elements; each being of size byte, word or long. When later referencing these elements, they begin with element 0 and end with element Count-1.

Explanation #

VAR is the Variable Block declaration. The Variable Block is a section of source code that declares global variable symbols. This is one of six special declarations (CON, VAR, OBJ, PUB, PRI, and DAT) that provide inherent structure to the Spin language.

In Spin, all variables defined in VAR blocks are initialized to zero. Though it is rarely implemented, it is possible to force these variables to initialize to a non-zero value upon the next boot up by including code that updates the application's global variable area in the external EEPROM.

See Variables for more information on variables in Spin.

Was this useful ?
Share This Article :
  • Facebook
  • X
  • LinkedIn
Still stuck? How can we help?

Still stuck? How can we help?

Updated on February 20, 2025
Table of Contents
  • Explanation

Copyright © 2025 - Parallax Inc.
599 Menlo Drive | Rocklin, CA 95765 | USA