Welcome to the Parallax Discussion Forums, sign-up to participate.

CalvinBreen
Posts: **7**

in Propeller 1

Hello,

I am muddling through .spin and would like to know what this structure represents, in plain English please.

w[btm_line]:=((?rand & $07) * 8)

I am familiar with BASIC from the 80's and this statement has me stumped. Clearly something (an array?) is being defined as being equal to a random number, which is logically combined to $07 for some reason, etc . Any help would be appreciated.

Thank you.

KB

I am muddling through .spin and would like to know what this structure represents, in plain English please.

w[btm_line]:=((?rand & $07) * 8)

I am familiar with BASIC from the 80's and this statement has me stumped. Clearly something (an array?) is being defined as being equal to a random number, which is logically combined to $07 for some reason, etc . Any help would be appreciated.

Thank you.

KB

## Comments

1,109dgately

22,917The rest should be straightforward if you remember that the assignment statement is written using ":=" rather than just an equal sign.

3,3867KB

6,235Jon McPhalenHollywood, CA

It's

JonorJonnyMac-- please do not call me Jonny.3,386"x := y" changes the variable (or array element) x to have the value y.

Here's how to initialize an array so that each element is equal to 0: This would be written in BASIC as (I've used the fastspin dialect, since that's one of the BASICs that runs on the propeller):

6,235bytefillandwordfill.Spin borrows Pascal's assignment operator for variables. For constants as single = sign is used. To test for equality, use ==. For example: This will set z to

trueif x and y are equal, false otherwise.Jon McPhalenHollywood, CA

It's

JonorJonnyMac-- please do not call me Jonny.