![]() |
|
Navigation |
Synopsis Variable in abstract pattern.
Syntax
Var
Description A variable pattern can act in two roles:
Examples Initialize variable
N
rascal>N = 10;
int: 10
and use N in a pattern; its value is used as value to match with:
rascal>N := 10; bool: true rascal>N := 20; bool: falseUse a non-existing variable in a pattern, it is bound when the match succeeds: rascal>import IO; ok rascal>if(M := 10) >>>>>>> println("Match succeeded, M == <M>"); Match succeeded, M == 10 ok ![]() |