コード例 #1
0
ファイル: If.cs プロジェクト: wiselynx/ComputerAlgebra
 public override void Execute(Dictionary <Expression, Expression> State)
 {
     if (cond.Evaluate(State))
     {
         _true.Execute(State);
     }
     else
     {
         _false.Execute(State);
     }
 }
コード例 #2
0
 public override void Execute(Dictionary <Expression, Expression> State)
 {
     for (init.Execute(State); cond.Evaluate(State); step.Execute(State))
     {
         try
         {
             body.Execute(State);
         }
         catch (BreakException) { break; }
         catch (ContinueException) { continue; }
     }
 }
コード例 #3
0
 public override void Execute(Dictionary <Expression, Expression> State)
 {
     do
     {
         try
         {
             body.Execute(State);
         }
         catch (BreakException) { break; }
         catch (ContinueException) { continue; }
     } while (cond.Evaluate(State));
 }
コード例 #4
0
 public override Expression Call(IEnumerable <Expression> Args)
 {
     try
     {
         body.Execute(parameters.Zip(Args, (a, b) => Arrow.New(a, b)));
     }
     catch (ReturnException Ret)
     {
         return(Ret.Value);
     }
     throw new InvalidOperationException("Return statement not executed.");
 }