diff --git a/README.md b/README.md index fa40604..f5c8850 100644 --- a/README.md +++ b/README.md @@ -25,4 +25,28 @@ class Main { } } } -``` \ No newline at end of file +``` + +## Iteration + +You would write iteration such that: + +```haxe +function f(s : String) : Void { + for (i in s.uLength()) { + trace(s.uCharAt(i)); + } +} +``` + +But `f(s)` has order of the square of the length of `s`. + +Instead, you can use `uIterator` to let the function be more efficient: + +```haxe +function f(s : String) : Void { + for (c in s.uIterator()) { + trace(c.toString()); + } +} +```