Stack and Lambda to filter values
Namespace myapp #Import "<std>" Using std.. Function Main() Local stack:=New Stack<Int> For Local n:=1 To 10 stack.Push(Rnd(1,100)) Next stack.Sort() ShowIt(stack) 'get only value >50 Local stack2:=New Stack<Int>'must be 'visible' outside of Lambda to be used Local check:=Lambda:Void(minvalue:Int,maxvalue:int) For Local x:=Eachin stack If x>=minvalue And x<=maxvalue stack2.Push(x) Next End check(30,50) 'calling the filtering Print "Filtered Stack is "+stack2.Length ShowIt(stack2) End Function ShowIt:Int(cnt:Stack<Int>) Local counter:Int For Local s:=Eachin cnt Print counter+" ["+s+"]" counter+=1 Next Return 0 End Function