Fixed the switch() function bug...
...which made this function always return second argument instead of proper result
This commit is contained in:
parent
7cd29ccaf8
commit
01d1d4179c
1 changed files with 2 additions and 2 deletions
|
@ -66,13 +66,13 @@ private:
|
|||
class switch_function : public function_expression {
|
||||
public:
|
||||
explicit switch_function(const args_list& args)
|
||||
: function_expression("switch", args, 4, -1)
|
||||
: function_expression("switch", args, 3, -1)
|
||||
{}
|
||||
|
||||
private:
|
||||
variant execute(const formula_callable& variables) const {
|
||||
variant var = args()[0]->evaluate(variables);
|
||||
for(int n = 0; n < args().size()-1; n += 2) {
|
||||
for(int n = 1; n < args().size()-1; n += 2) {
|
||||
variant val = args()[n]->evaluate(variables);
|
||||
if(val == var) {
|
||||
return args()[n+1]->evaluate(variables);
|
||||
|
|
Loading…
Add table
Reference in a new issue