calcium-lang
Version:
Calcium language interpreter
22 lines • 572 B
JavaScript
import Conditional from "./conditional";
import retrieveValue from "../util/retrieveValue";
/**
* if control flow
*/
export default class If extends Conditional {
/**
*
* @param condition an arbitrary expression to determine whether
* the statement shoule be executed
*/
constructor(condition) {
super();
this.condition = condition;
}
isSatisfied(env) {
const value = retrieveValue(this.condition, env);
const result = value ? true : false;
return result;
}
}
//# sourceMappingURL=if.js.map