user3557210
user3557210

Reputation: 1

cannot recall original 'x' variable of function object?

If an object's, e.g. this:

function Circle (a,y,r)

variable a has been called later in form:

Circle(var1+var2++, y,r);

or.

Circle(var1+var2,y,r);
xInc = 1;
var2 += xInc; 

Is there a way to recall original 'a' variable for the conditional? Have already tried direct calling of object parameter like:

if (Circle.x > 40) { xInc = -xInc };

So long as it's constructive, feel free to pull my current understanding(s) to pieces ;]

Upvotes: 0

Views: 49

Answers (1)

Quentin
Quentin

Reputation: 943217

When you call a function, you pass an expression to it.

The result of evaluating the expression will be stored in a variable that is local to that function.

Unless either:

  • the function explicitly copies it somewhere else
  • you already have a copy of it somewhere else

…it will not be available outside the function.

Upvotes: 1

Related Questions