(#load_or(, default) is broken in the Overview and leads to a compiler error.
Code Example
package main
import "core:fmt"
main :: proc() {
bar := #load("testfile.txt") or_else ([]u8{104, 105})
biz := #load(" ") or_else ([]u8{104, 105})
/* buz := #load_or("testfile.txt", []u8 { 104, 105 })
the line of commented code above ^ errors now, Overview needs update
error: #load_or' has now been removed in favour of '#load(path) or_else
default' */
fmt.println("bar:\n", string(bar))
fmt.println("biz:", string(biz))
// fmt.println(string(buz))
}
Output
bar:
this is my test file
it has two lines
biz: hi
Current Behavior (with Compiler Error)
ERROR: #load_or has now been removed in favour of '#load(path) or_else default'
Change This in the Overview From
"#load_or(, default)"
Returns a []u8 of file contents at compile time, otherwise default content when the file wasn’t found.
Link to Issue Item
https://odin-lang.org/docs/overview/#load_orstring-path-default
Issue in Short
Code Example
Output
Current Behavior (with Compiler Error)
ERROR: #load_or has now been removed in favour of '#load(path) or_else default'
Change This in the Overview From
"#load_or(, default)"
Returns a []u8 of file contents at compile time, otherwise default content when the file wasn’t found.
Change the Overview to This
"#load(path) or_else default" Returns a []u8 of file contents at compile time, otherwise default content when the file wasn’t found.