projects
/
onyx.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5b5eca5
)
fixed a small bug because && does not short circuit
author
Brendan Hansen
<brendan.f.hansen@gmail.com>
Sat, 24 Apr 2021 16:39:19 +0000
(11:39 -0500)
committer
Brendan Hansen
<brendan.f.hansen@gmail.com>
Sat, 24 Apr 2021 16:39:19 +0000
(11:39 -0500)
core/string.onyx
patch
|
blob
|
history
diff --git
a/core/string.onyx
b/core/string.onyx
index e9ad0fc1024514c6756b23e735badf1a090a4581..6bf5a7dcec10ae628415cf371597b04c99f068b8 100644
(file)
--- a/
core/string.onyx
+++ b/
core/string.onyx
@@
-111,7
+111,10
@@
contains :: proc {
// it will work perfectly yet. - brendanfh 2020/12/21
compare :: (str1: str, str2: str) -> i32 {
i := 0;
- while i < str1.count && i < str2.count && str1[i] == str2[i] do i += 1;
+ while i < str1.count && i < str2.count {
+ if str1[i] == str2[i] do i += 1;
+ else do break;
+ }
if i == str1.count && i == str2.count do return 0;
return ~~(str1[i] - str2[i]);