Difference between revisions of "Self"
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | [[Category: Concepts]] | |
− | |||
− | |||
− | The other exception is in [[IntraTable]] | + | The keyword [[Self]] is used in the definition of a Variable to refer to that variable. |
+ | |||
+ | Usually, a variable cannot refer to itself -- because it creates a cyclic dependency -- so you cannot use [[Self]] in common expressions. One exception is in the [[Dynamic]] function when referring to [[Self]] at a preceding [[Time]] period, e.g. | ||
+ | |||
+ | :<code>Variable X := Dynamic(10, Self[Time - 1]*(1 + growth))</code> | ||
+ | |||
+ | The last parameter of [[Dynamic]] is an expression that can refer to [[Self]], provided it is for a previous [[Time]], as in this case. | ||
+ | |||
+ | The other exception is in [[IntraTable]] that allows cells of a table to refer to each other, using [[Self]]. | ||
+ | |||
+ | ==See Also== | ||
+ | * [[Self-Indexed Arrays]] | ||
+ | * [[Dynamic]] | ||
+ | * [[Time]] |
Latest revision as of 20:38, 5 February 2016
The keyword Self is used in the definition of a Variable to refer to that variable.
Usually, a variable cannot refer to itself -- because it creates a cyclic dependency -- so you cannot use Self in common expressions. One exception is in the Dynamic function when referring to Self at a preceding Time period, e.g.
Variable X := Dynamic(10, Self[Time - 1]*(1 + growth))
The last parameter of Dynamic is an expression that can refer to Self, provided it is for a previous Time, as in this case.
The other exception is in IntraTable that allows cells of a table to refer to each other, using Self.
See Also
Comments
Enable comment auto-refresher