User Story #13: If 2 or more operators are entered consecutively, the operation performed should be the last operator entered (excluding the negative (-) sign). For example, if 5 + * 7 = is entered, the result should be 35 (i.e. 5 * 7); if 5 * - 5 = is entered, the result should be -25 (i.e. 5 x (-5)).
Do you understand the task properly? Can you describe it in your own words?
When I input 2-*3,
I get the error: SyntaxError: expected expression, got '*'.
Do you know what this error means? Do you know why it comes up?
I only left basic part uncommented (add operator characters to input) .
Honestly this user story is not completely clear to me, i see what behavior is expected in the tests, but e.g. should 5--3 be 5-3 or 5+3 (mathematically correct version)?
there are 3 options for newly added characters: add, replace,ignore, 2 groups of operators '-' and !'-'
when i enter operators except for '-' consecutively the last entered operator is used.
replaces preceding +, not sure abt -
added to input after * or /
if the 3rd operator is entered after *- or /-, use the last entered operator.
I can’t generalize these conditions i’m pretty sure there’s something else…
Also when i tried to keep track of number of consequtive operators in state, it’s not quite what I expected, there’s clearly an operator in the input, but in state it’s 0. Is this the time when i need functional setState?
2-*3 hmm it makes no sense and * operator can’t be converted to number?