Order of precedence

Report a typo

Arrange the operations in the following code according to their execution order based on their precedence:

fun main() {
   var a = 5
   val b = 9
   val c = 11
   var d = 1
   d *= ++a + b%(c - 3) // order of execution in this line
   println(d)   
}

Remember, the operations are executed from left to right, however parentheses are very important! If you run into difficulties, please revisit the "Order of Precedence" section in the theory.

Put the items in the correct order
*=
++
%
+
-
___

Create a free account to access the full topic