Dart double operator-greater-than-or-equal-to
Syntax & Examples


double.operator-greater-than-or-equal-to operator

The relational greater than or equal operator compares the given numeric value with another numeric value and returns true if the first value is greater than or equal to the second value; otherwise, it returns false.


Syntax of double.operator-greater-than-or-equal-to

The syntax of double.operator-greater-than-or-equal-to operator is:

operator >=(num other) → bool

This operator-greater-than-or-equal-to operator of double relational greater than or equal operator.

Parameters

ParameterOptional/RequiredDescription
otherrequiredthe numeric value to compare with


✐ Examples

1 Example with positive values

In this example,

  1. We create two positive numeric values numValue1 and numValue2 with values 10 and 5 respectively.
  2. We then use the greater than or equal operator >= to compare numValue1 with numValue2.
  3. We print the comparison result to standard output.

Dart Program

void main() {
  num numValue1 = 10;
  num numValue2 = 5;
  bool isGreaterOrEqual = numValue1 >= numValue2;
  print('Is $numValue1 greater than or equal to $numValue2: $isGreaterOrEqual');
}

Output

Is 10 greater than or equal to 5: true

2 Example with equal values

In this example,

  1. We create two numeric values numValue1 and numValue2 with the same value 3.5.
  2. We then use the greater than or equal operator >= to compare numValue1 with numValue2.
  3. We print the comparison result to standard output.

Dart Program

void main() {
  num numValue1 = 3.5;
  num numValue2 = 3.5;
  bool isGreaterOrEqual = numValue1 >= numValue2;
  print('Is $numValue1 greater than or equal to $numValue2: $isGreaterOrEqual');
}

Output

Is 3.5 greater than or equal to 3.5: true

3 Example with negative values

In this example,

  1. We create two negative numeric values numValue1 and numValue2 with values -8 and -12 respectively.
  2. We then use the greater than or equal operator >= to compare numValue1 with numValue2.
  3. We print the comparison result to standard output.

Dart Program

void main() {
  num numValue1 = -8;
  num numValue2 = -12;
  bool isGreaterOrEqual = numValue1 >= numValue2;
  print('Is $numValue1 greater than or equal to $numValue2: $isGreaterOrEqual');
}

Output

Is -8 greater than or equal to -12: true

Summary

In this Dart tutorial, we learned about operator-greater-than-or-equal-to operator of double: the syntax and few working examples with output and detailed explanation for each example.