Re: Declaring variables outside subroutines

From: Joe Smith (Joe.Smith_at_inwap.com)
Date: 03/26/04


Date: Fri, 26 Mar 2004 09:47:18 GMT

Appoooh wrote:

> I'm no guru, and I haven't been programming professionally for long, but I
> can't help finding it disturbing that in the code below, $var is in scope
> within the subroutine foo. This is a bit eccentric compared to C++ or Java

It's standard procedure for creating static variables in C.
        -Joe



Relevant Pages

  • Re: Dynamic variable names
    ... Note that var defines the scope of a variable. ... variable you initialize belongs to the scope where it has been ... But it has been added no assignment yet, ...
    (comp.lang.javascript)
  • Re: function pointers vs direct calling in javascript
    ... scope tree to look for 'tempVar2' or for some other reason? ... Here is what I think of 'var', correct me if I am wrong. ... 'var' doesn't as such declare a variable. ... a property of the global object when the code executes. ...
    (comp.lang.javascript)
  • Re: Lets organize our Delphi code
    ... Well, no, I don't think a Delphi compiler capable of block scope variables should do it that way internally. ... The report was opened in the same day by Chris Pattinson. ... I don't think that would be slower at runtime (if no hidden nested procedures are generated by the compiler). ...
    (borland.public.delphi.non-technical)
  • Re: RFC -- Function.prototype.partial() -- a proposal for ECMAScript4
    ... as this to fix the scope ... var bert =; ... var partiallyCalledFoo = Function.partialCall; ...
    (comp.lang.javascript)
  • Re: "with" statement, extending prototype
    ... var myfunc = function myfunc; ... Where 'current scope object' is what, ... var Car = function ...
    (comp.lang.javascript)

Loading