diff options
| author | Laytan Laats <laytanlaats@hotmail.com> | 2026-01-11 20:09:40 +0100 |
|---|---|---|
| committer | Laytan Laats <laytanlaats@hotmail.com> | 2026-01-11 20:21:25 +0100 |
| commit | 6c663b7a71ddd1288b92cd47eb6876e96cb3ab34 (patch) | |
| tree | e9f2b89191c95b9b53030c35d452b94e13a21b47 /core/slice | |
| parent | f6b8e086283a63d49327f5b5eecaa3b32434030a (diff) | |
slice: fix examples
Diffstat (limited to 'core/slice')
| -rw-r--r-- | core/slice/sort.odin | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/core/slice/sort.odin b/core/slice/sort.odin index d438cfc1b..9f91a0f73 100644 --- a/core/slice/sort.odin +++ b/core/slice/sort.odin @@ -300,7 +300,9 @@ Example: import "core:slice" import "core:fmt" - main :: proc() { + stable_sort_by_example :: proc() { + Example :: struct { n: int, s: string } + arr := []Example { {2, "name"}, {3, "Bill"}, @@ -312,10 +314,9 @@ Example: }) for e in arr do fmt.printf("%s ", e.s) + fmt.println() } - Example :: struct { n: int, s: string } - Output: My name is Bill */ @@ -335,7 +336,9 @@ Example: import "core:slice" import "core:fmt" - main :: proc() { + stable_sort_by_cmp_example :: proc() { + Example :: struct { n: int, s: string } + arr := []Example { {2, "name"}, {3, "Bill"}, @@ -347,9 +350,9 @@ Example: }) for e in arr do fmt.printf("%s ", e.s) + fmt.println() } - Example :: struct { n: int, s: string } Output: My name is Bill */ |