StandardCalculator.MemoryMinus(int,decimal) - YiZhang-Paul/Mock_Up_Calculator GitHub Wiki
Namespace: CalculatorClassLibrary
Description: Subtracts arbitrary value from memory value at specified index.
| Parameters | Description |
|---|---|
| key<int> | index of target memory value |
| value<decimal> | value to subtract |
| Returns | Description |
|---|---|
| void | this method does not return anything |
| Exceptions | Cause |
|---|---|
| ArgumentOutOfRangeException | key is not a valid index |
| OverflowException | subtraction results in a value larger than decimal.MaxValue |
Examples:
//memory values are [1, 3, 5, 7]
standardCalculator.MemoryMinus(0, 7); //memory values are now [-6, 3, 5, 7]
standardCalculator.MemoryMinus(1, 3); //memory values are now [-6, 0, 5, 7]
standardCalculator.MemoryMinus(-1, 7); //will throw exception
standardCalculator.MemoryMinus(0, -1 * decimal.MaxValue); //will throw exception