Beispiel #1
0
        public override Value Evaluate(RumorScope scope)
        {
            var value = scope.Get(name);

            if (value == null)
            {
                throw new UndefinedVariableException(
                          "Variable \"" + name + "\" has not been defined yet!"
                          );
            }

            return(value);
        }
        public override Value Evaluate(RumorScope scope)
        {
            var value = scope.Get(name);

            if (value == null)
            {
                throw new UndefinedVariableException(
                          "Variable \"" + name + "\" has not been defined yet!"
                          );
            }
            if (!(value is NumberValue))
            {
                throw new VariableTypeException(
                          "Variable is not a number!"
                          );
            }

            return((NumberValue)value);
        }