0 of 10 problems solved • 0%
Use in a course

Exercise prompt

Update a Balance

The operators += and -= are concise ways to update a number using its current value. balance += 10 means the same as balance = balance + 10.

Example

let points = 20; points += 5; points -= 2;

The final value is 23. Your exercise updates an account balance.

Your task

The balance starts at 100. Deposit 25 with +=, then spend 40 with -=. The console should display Balance: 85.