# Local Variables (New Features)

Hi Jim

I´m doing a project with my year 7 class. Each student makes a car or a house and then I put it in a subroutine and add some movement.

See the example below.

We have to use a different variable x x1 x2 x3 .... for each car, or else the program will consider as a unique variable.

Regards

Manuel

graphsize 900,500

fastgraphics

for p = 1 to 100000 step 1

call ritacar(p)

call sidneycar(p)

refresh

clg

next p

subroutine ritacar(p)

if p=1 then x=400

x=x+1

if x>1000 then x = 0

y=60

color yellow

rect 910-x,270+y,60,20

color yellow

rect 930-x,230+y,70,60

color black

font "Arial Black",12,50

Text 935-x,230+y,"School"

color darkcyan

rect 935-x,250+y,60,20

color black

circle 925-x,290+y,10

color black

circle 990-x,290+y,10

end subroutine

subroutine sidneycar(p)

if p=1 then x1=0

x1=x1+1.5

if x1>1200 then x1 = 0

color darkblue

rect 910-x1,270+y,60,20

color darkblue

rect 930-x1,260+y,40,20

color black

circle 925-x1,290+y,10

color black

circle 955-x1,290+y,10

end subroutine

**Complete thread:**

- Local Variables -
**M Santos**, 2012-10-29, 19:18- Local Variables -
**Jim**, 2012-10-29, 21:56- Local Variables -
**M Santos**, 2012-10-30, 21:10- Local Variables -
**Jim**, 2012-10-30, 22:31- Local Variables -
**M Santos**, 2012-10-31, 16:00- Local Variables -
**Jim**, 2012-10-31, 18:27

- Local Variables -

- Local Variables -

- Local Variables -

- Local Variables -

- Local Variables -