Skip to content

Latest commit

 

History

History
28 lines (23 loc) · 540 Bytes

File metadata and controls

28 lines (23 loc) · 540 Bytes

Multiplication

You can multiply any two doubles using the * operator.

~void main() {
double x = 3;
// y will be 27
double y = x * 9;
// z will be 13.5
double z = y * 0.5;

IO.println(x);
IO.println(y);
IO.println(z);
~}

Just like with addition and subtraction, it is fine to use both integers and integer literals when doing multiplication on doubles. So long as any number being used is a double the overall result will be a double.

~void main() {
// a will be 3.0
double a = 1.5 * 2;
IO.println(a);
~}