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,081dgately

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

2,8467KB

6,166Jon McPhalenHollywood, CA

It's

JonorJonnyMac-- please do not call me Jonny.2,846"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,166bytefillandwordfill.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.