Determine if one value is greater than or equal to another with the <= operator. Notice the = comes after the <.
public static boolean compare(int val1, int val2) {
boolean result = val1 <= val2;
return result;
}
Function Call | Return Value | |||
---|---|---|---|---|
compare(6, 4) | → | |||
compare(12, 12) | → | |||
compare(8, 8) | → | |||
compare(12, 24) | → | |||
compare(7, 2) | → |
Experiment with this code on Gitpod.io