From 44eb526e0624bb896e75a81f600a869cb4393030 Mon Sep 17 00:00:00 2001 From: DieMyst Date: Thu, 10 Mar 2022 15:23:05 +0300 Subject: [PATCH] add closure tests --- aqua/examples/closures.aqua | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/aqua/examples/closures.aqua b/aqua/examples/closures.aqua index 6107253..153a1ba 100644 --- a/aqua/examples/closures.aqua +++ b/aqua/examples/closures.aqua @@ -23,15 +23,26 @@ func closureIn(peer1: string) -> string: <- p func closureOut(peer2: string) -> Info: - closure = (s: string) -> Info: - if s == "in": - LocalSrv.inside() - p2Id <- Peer.identify() - <- p2Id on peer2: - p2Id <- closure("on") + closure = (s: string) -> Info: + if s == "in": + LocalSrv.inside() + p2Id <- Peer.identify() + <- p2Id + p2Id <- closure("on") <- p2Id +-- func closureOut2(peer2: string) -> Info: +-- closure = func (s: string) -> Info: +-- if s == "in": +-- LocalSrv.inside() +-- p2Id <- Peer.identify() +-- <- p2Id +-- on peer2: +-- p2Id <- closure("on") +-- <- p2Id + + func closureBig(peer1: string, peer2: string) -> string, string: variable = "const" co on peer1: