Dart double operator-multiplication
Syntax & Examples
double.operator-multiplication operator
The multiplication operator multiplies the given numeric value by another numeric value and returns a double result.
Syntax of double.operator-multiplication
The syntax of double.operator-multiplication operator is:
operator *(num other) → doubleThis operator-multiplication operator of double multiplication operator.
Parameters
| Parameter | Optional/Required | Description |
|---|---|---|
other | required | the numeric value to multiply with |
✐ Examples
1 Example with integer values
In this example,
- We create two integer values
numValue1andnumValue2with values 10 and 5 respectively. - We then use the multiplication operator
*to multiplynumValue1andnumValue2. - We print the multiplication result to standard output.
Dart Program
void main() {
num numValue1 = 10;
num numValue2 = 5;
double result = numValue1 * numValue2;
print('Multiplication result: $result');
}Output
Multiplication result: 50.0
2 Example with floating-point values
In this example,
- We create two floating-point values
numValue1andnumValue2with values 3.5 and 2 respectively. - We then use the multiplication operator
*to multiplynumValue1andnumValue2. - We print the multiplication result to standard output.
Dart Program
void main() {
num numValue1 = 3.5;
num numValue2 = 2;
double result = numValue1 * numValue2;
print('Multiplication result: $result');
}Output
Multiplication result: 7.0
3 Example with negative values
In this example,
- We create two numeric values
numValue1andnumValue2with values -8 and 4 respectively. - We then use the multiplication operator
*to multiplynumValue1andnumValue2. - We print the multiplication result to standard output.
Dart Program
void main() {
num numValue1 = -8;
num numValue2 = 4;
double result = numValue1 * numValue2;
print('Multiplication result: $result');
}Output
Multiplication result: -32.0
Summary
In this Dart tutorial, we learned about operator-multiplication operator of double: the syntax and few working examples with output and detailed explanation for each example.