|
|
> To me, all that tricky slight of hand with "break" and "continue" seems
> far less clear then just directly saying exactly what you want to happen,
> as the Haskell version does.
You can eliminate the "continue" in your example if you write it like this:
if ( cmd == "^" )
break;
else if ( cmd == "+" )
Add(stack);
else if ( cmd == "-" )
Sub(stack);
else
stack.push_back(1);
As for the break, it could just as easily be a 'return' like in the haskell
code, if you didn't want to print "exit" or if you brought the loop into its
own function.
- Slime
[ http://www.slimeland.com/ ]
Post a reply to this message
|
|