![]() |
|
Navigation |
Synopsis The special variable
it occurs outside a reducer expression.
Description A Rascal:Reducer is used to reduce all elements in a collection to a sngle value.
The special variable
it represents the currently reduced value and can be modified inside the reducer.
This error is generated when it i used otuside the a reducer.
Remedies:
Examples This is correct way to add all elements in a list:
rascal>(0 | it + n | int n <- [1,5,9] )
int: 15
Using it outside a reducer gives an error:
rascal>it + 3
|stdin:///|(0,2,<1,0>,<1,2>): Use of 'it' special variable is only allowed within reducers
![]() |