Пример #1
0
        public Void VisitIfStmt(Stmt.If stmt)
        {
            Resolve(stmt.condition);
            Resolve(stmt.thenBranch);

            if (stmt.elseBranch != null)
            {
                Resolve(stmt.elseBranch);
            }

            return(null);
        }
Пример #2
0
 public Void VisitIfStmt(Stmt.If stmt)
 {
     if (IsTruthy(Evaluate(stmt.condition)))
     {
         Execute(stmt.thenBranch);
     }
     else if (stmt.elseBranch != null)
     {
         Execute(stmt.elseBranch);
     }
     return(null);
 }