Esempio n. 1
0
        public string VisitIfStmt(Stmt.If stmt)
        {
            if (stmt.ElseBranch == null)
            {
                return(Parenthesize2("if", stmt.Condition, stmt.ThenBranch));
            }

            return(Parenthesize2("if-else", stmt.Condition, stmt.ThenBranch,
                                 stmt.ElseBranch));
        }
Esempio n. 2
0
 public object VisitIfStmt(Stmt.If stmt)
 {
     Resolve(stmt.Condition);
     Resolve(stmt.ThenBranch);
     if (stmt.ElseBranch != null)
     {
         Resolve(stmt.ElseBranch);
     }
     return(null);
 }
Esempio n. 3
0
 public object VisitIfStmt(Stmt.If stmt)
 {
     if (IsTruthy(Evaluate(stmt.Condition)))
     {
         Execute(stmt.ThenBranch);
     }
     else if (stmt.ElseBranch != null)
     {
         Execute(stmt.ElseBranch);
     }
     return(null);
 }