From 5fc7577b5a3bc2c445522dfd5b287e1c6eddc3e9 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 31 Aug 2025 23:33:22 -0400 Subject: Switch to using optional return values for list indexing. --- examples/ini/ini.tm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/ini/ini.tm') diff --git a/examples/ini/ini.tm b/examples/ini/ini.tm index 4dc27725..790b3abc 100644 --- a/examples/ini/ini.tm +++ b/examples/ini/ini.tm @@ -40,20 +40,20 @@ func main(path:Path, key:Text?) ") data := parse_ini(path) - if keys.length < 1 or keys[1] == '*' + if keys.length < 1 or keys[1]! == '*' say("$data") return - section := keys[1].lower() + section := keys[1]!.lower() section_data := data[section] or exit(" Invalid section name: \[31;1]$section\[] Valid names: \[1]$(", ".join([k.quoted() for k in data.keys]))\[] ") - if keys.length < 2 or keys[2] == '*' + if keys.length < 2 or keys[2]! == '*' say("$section_data") return - section_key := keys[2].lower() + section_key := keys[2]!.lower() value := section_data[section_key] or exit(" Invalid key: \[31;1]$section_key\[] Valid keys: \[1]$(", ".join([s.quoted() for s in section_data.keys]))\[] -- cgit v1.2.3