PRG 215 Wk 2 Discussion – Compound Assignment Operators

0 items
PRG 215 Wk 2 Discussion - Compound Assignment Operators
PRG 215 Wk 2 Discussion – Compound Assignment Operators
$3.00
  • Description

PRG 215 Wk 2 Discussion – Compound Assignment Operators

Post a total of 3 substantive responses over 2 separate days for full participation. This includes your initial post and 2 replies to other students.

Due Thursday

Respond to the following in a minimum of 175 words:

A compound assignment operator like += or -= is an operator that does two things at the same time: first, it peforms a calculation; and second, it assigns the calculated value to a variable or constant.

Review the following two examples:

  • totalPoints +=95; same as totalPoints = totalPoints + 95
  • finalGrade -= 30;same as finalGrade = finalGrade – 30

Discuss the possible benefits, if any, of using a compound operator vs. the alternative. Can you think of any drawbacks to using compound operators?

Due Monday

Reply to at least two of your classmates. Be constructive and professional in your responses