Use chars() to iterate strings.

This commit is contained in:
Stephen Chung
2021-06-07 09:47:49 +08:00
parent 859a18c6fd
commit 989cb702c0
5 changed files with 87 additions and 13 deletions

View File

@@ -235,7 +235,7 @@ fn test_for_string() -> Result<(), Box<EvalAltResult>> {
let s = "hello";
let sum = 0;
for ch in s {
for ch in s.chars() {
sum += to_int(ch);
}