GREEN: Fix empty string bug

- Changed return value from 1 to 0 for empty string
- Test now passes: empty string returns 0
This commit is contained in:
fiatcode 2026-02-18 12:56:17 +07:00
parent e38bac9441
commit 164adf815d

View file

@ -12,7 +12,7 @@ class StringCalculator {
int add(String numbers) { int add(String numbers) {
// Bug 1: Empty string handling // Bug 1: Empty string handling
if (numbers.isEmpty) { if (numbers.isEmpty) {
return 1; // Should return 0 return 0; // Fixed: Return 0 for empty string
} }
// Bug 2: Single number parsing // Bug 2: Single number parsing