Declaring Variables

Dave dave at looktowindward.com
Thu Nov 30 06:15:37 EST 2006


On 28 Nov 2006, at 21:20, Francis Nugent Dixon wrote:

>
> but I think that you are pushing the envelope just a little too  
> much, especially if Jo is a beginner.
>
> Please be assured that I am not knocking you, because you may know  
> lots more about Revolution and
> Transcript than I do. But the problem is not there :
>
> 1 - Look at the question
> 2 - Based upon the question and the way it was asked, judge the  
> level of the person who asked the question.
> 3 - Answer the question on that level.
>
> Let's look at the question ...........
>
>> From: Jo - LunchnMeets at aol.com
>
>> I've seen references to declaring or initializing variables. How  
>> and why
>> would I do that?
>
> This question is phrased like Jo is a relative beginner. You may  
> have even have scared him off by your answers.
>
> So, assuming he is a beginner, here we go ....... !
>
> Jo - In the cards of your stacks you can create fields containing  
> information. These fields can contain ANYTHING, numbers, texts,  
> binaries, on/off switches.

begin NEWBIE_MODE
Binaries? What are those?
end NEWBIE_MODE

Also the use of the word field is confusing here, "fields" in RunRev  
contain strings, a better word would have been Objects.

The main point is that by declaring local's you make your code more  
robust and reduce the chances of making a "silly" script editor  
typing error.

There seems to be an exception to the general rule when it comes to  
repeat tho:

repeat with myIndex = 1 to 100

Will NOT error if myIndex is NOT Declared whether the option to  
declare locals is on or off.

If myIndex is declared, I'm not sure if it creates a new instance of  
myIndex or not, or what it should do in this case. Any ideas?

All the Best
Dave








More information about the Use-livecode mailing list