[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LOGO-L> Need help with variables



Kathy,
 If your procedure is like this:-

to square :side
pd 
repeat 4[fd :side rt 90]
end

then your variable will be local
to test this, 
first, run the procedure
sq 50
then try to find the value of :side
show :side
You will get a message, like, "side has no value"

The advantage of local over globals is that you can write other procedures for 
other shapes and still use the variable side,

eg. 
to tri :side
   repeat 3 [fd :side rt 120]
end

etc. 

-- Bill Kerr 

You wrote:-
>trouble distinguishing between global and local variables.  I know that
>global variables are created with make " and a local variable is within
>one procedure only.  However, I have a problem with understanding why if
>running a procedure such as square :side a global variable is created
>rather than a local.  Does this make any sense to you because I am
>lost?  

---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org.  Mail
questions about the list administration to logofdn@gsn.org.  To
unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home