From 58aa2f83a9320674830d9e81f59c3716c8db678a Mon Sep 17 00:00:00 2001 From: Emma Date: Sun, 4 Feb 2024 14:12:46 +0200 Subject: [PATCH] Turn if operation to a ternary operation --- src/main/java/frc/robot/leds/LedStrip.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/leds/LedStrip.java b/src/main/java/frc/robot/leds/LedStrip.java index 8a69719f..aa88af95 100644 --- a/src/main/java/frc/robot/leds/LedStrip.java +++ b/src/main/java/frc/robot/leds/LedStrip.java @@ -213,8 +213,8 @@ public Command blink(DoubleSupplier blinkTime) { return this.run( () -> { setBlinkTime(blinkTime.getAsDouble()); - if (currentColor == primary) currentColor = secondary; - else currentColor = primary; + currentColor = currentColor == primary ? + secondary : primary; if (timer.advanceIfElapsed(this.blinkTime) && this.blinkTime > LedConstants.MINIMAL_BLINK_TIME) { setSolidColor(currentColor);