I'm confused with which how Kotlin utilizes order of operations and significant figures. | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

I'm confused with which how Kotlin utilizes order of operations and significant figures.

Mainly regarding my issues with the "Parking Fees" assignment. An example of an error was 1*hours vs hours*1.0 where the latter gave me the correct output.

16th Feb 2022, 8:16 PM
John Paul Ronquillo
John Paul Ronquillo - avatar
1 Réponse
+ 3
Multiplication is commutative, even in Kotlin, that means a * b = b * a However, the data type of the result does depend on the type of the operands. If you multiply two integers, the result will also be an Int. If you multiply an Int and a Double (no matter in which order), the result will be Double.
16th Feb 2022, 9:11 PM
Tibor Santa
Tibor Santa - avatar