From 046a3933134080210803582cc49fc310f00834bb Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Fri, 6 Jun 2025 12:10:46 +0200 Subject: [PATCH] Simplified for loops --- Contains.go | 4 ++-- README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Contains.go b/Contains.go index 11621af..69205bc 100644 --- a/Contains.go +++ b/Contains.go @@ -60,7 +60,7 @@ func contains(container any, element any) bool { matchingElements := 0 - for i := 0; i < containerValue.Len(); i++ { + for i := range containerValue.Len() { if containerValue.Index(i).Interface() == elementValue.Index(matchingElements).Interface() { matchingElements++ } else { @@ -75,7 +75,7 @@ func contains(container any, element any) bool { return false } - for i := 0; i < containerValue.Len(); i++ { + for i := range containerValue.Len() { if containerValue.Index(i).Interface() == element { return true } diff --git a/README.md b/README.md index 56158ea..b1658bc 100644 --- a/README.md +++ b/README.md @@ -51,4 +51,4 @@ Please see the [license documentation](https://urbach.dev/license). ## Copyright -© 2019 Eduard Urbach +© 2019 Eduard Urbach \ No newline at end of file