예제 #1
0
 public void Visit(Stmt.If stmt)
 {
     Resolve(stmt.condition);
     Resolve(stmt.thenBranch);
     if (stmt.elseBranch != null)
     {
         Resolve(stmt.elseBranch);
     }
 }
예제 #2
0
 public void Visit(Stmt.If stmt)
 {
     if (IsTruthy(Evaluate(stmt.condition)))
     {
         Execute(stmt.thenBranch);
     }
     else if (stmt.elseBranch != null)
     {
         Execute(stmt.elseBranch);
     }
 }