Home
Project Folders
Teacher Resources
Student Resources
How Do I?
Literacy
MWForum
Site Map
Search
Our Team

MWForum Message [Date Index] [Threads] [Authors] [Attachments] [Subscribe]

[Thread Prev] [Thread Next]

To: MicroWorlds Forum <mwforum@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: variables or procedure inputs
From: sanjeev singh <snjvsingh123@xxxxxxxxx>
Date: Sat, 7 Jan 2012 22:01:02 -0500

Thanks,
Is there a good book to just read the details of the language. I am a
 C/C++ programmer and so want to understand it from a computer science of
view. like variable scope, encapsulation ...etc I was just typing the
program from the book "Mindstorms" but I guess language has evolved from
those days.
-sanjeev


2012/1/6 Rotem Kimchi <rotemk2@xxxxxxxxxxxxxxxx>

> understood thanks
>
> 2012/1/6 Daniel Ajoy <da.ajoy@xxxxxxxxx>
>
>> On Fri, 06 Jan 2012 10:45:10 -0500, Rotem Kimchi <
>> rotemk2@xxxxxxxxxxxxxxxx> wrote:
>>
>>  if you want distance to be a variable you need to add ":" to the
>>> distance variable
>>>
>>> to start
>>> make "distance 10
>>> tto "t1
>>> make "distance spi :distance
>>> end
>>>
>>> to spi :distance
>>> forward "distance
>>> rt 90
>>> op :distance + 10
>>> end
>>>
>>
>> Or just:
>>
>> to start
>> tto "t1
>> spi 10
>> end
>>
>> to spi :distance
>> forward :distance
>> rt 90
>> spi :distance + 10
>> end
>>
>> Rotem, notice that here "distance" is not really a variable, like the
>> ones handled with "make".
>>
>> In this case "distance" is really the input of a procedure. Those are two
>> different kinds of "variables".
>>
>>
>> Try this:
>>
>> to start
>> make "variable 10
>>
>> show "outside.before
>> show :variable
>>
>> manipulate :variable
>>
>> show "outside.after
>> show :variable
>> end
>>
>> to manipulate :variable
>>
>> show "inside.before
>> show :variable
>>
>> make "variable :variable + 1
>>
>> show "inside.after
>> show :variable
>> end
>>
>>
>> I think you will be surprised to see what the last result is 10.
>>
>> Daniel
>> OpenWorld Learning
>>
>> ______________________________**_________________
>> MWForum mailing list
>> MWForum@groups.**openworldlearning.org<MWForum@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
>> 
http://mia.openworldlearning.**org/mwforum.htm<http://mia.openworldlearning.org/mwforum.htm>
>>
>
>
>

  • Previous by thread: Re: variables or procedure inputs
  • Next by thread: Re: variables or procedure inputs

  • To save an attachment to your computer, PC users should right-click (Mac users, click and hold the mouse button) on the link and then choose 'save target as' from the pop-up menu. A window will then pop up in which you can choose a location for the file.


    © copyright 2001 - 2008