aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-06 13:40:17 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-06 13:40:17 -0400
commit59845e610f2c90474f34079d27b5f1e07071ded4 (patch)
tree1066ab6c5c6e6620adda6ac4575703b9d4bf0a0a /examples
parent95633b1cc2da5294d9aec8c7eb9fca9a15c1a8bf (diff)
Deprecate `!!` print statement
Diffstat (limited to 'examples')
-rw-r--r--examples/http-server/http-server.tm2
-rw-r--r--examples/http/http.tm14
-rw-r--r--examples/ini/ini.tm4
-rw-r--r--examples/learnxiny.tm3
-rw-r--r--examples/tomodeps/tomodeps.tm2
5 files changed, 11 insertions, 14 deletions
diff --git a/examples/http-server/http-server.tm b/examples/http-server/http-server.tm
index 56ba3683..1a09b601 100644
--- a/examples/http-server/http-server.tm
+++ b/examples/http-server/http-server.tm
@@ -138,7 +138,7 @@ func load_routes(directory:Path -> {Text=RouteEntry}):
func main(directory:Path, port=Int32(8080)):
say("Serving on port $port")
routes := load_routes(directory)
- !! Hosting: $routes
+ say(" Hosting: $routes")
serve(port, func(request:HTTPRequest):
if handler := routes[request.path]:
diff --git a/examples/http/http.tm b/examples/http/http.tm
index ce74d010..12d9978e 100644
--- a/examples/http/http.tm
+++ b/examples/http/http.tm
@@ -97,17 +97,17 @@ func delete(url:Text, data:Text?=none, headers=["Content-Type: application/json"
return _send(DELETE, url, data, headers)
func main():
- !! GET:
+ say("GET:")
say(get("https://httpbin.org/get").body)
- !! Waiting 1sec...
+ say("Waiting 1sec...
sleep(1)
- !! POST:
+ say("POST:")
say(post("https://httpbin.org/post", `{"key": "value"}`).body)
- !! Waiting 1sec...
+ say("Waiting 1sec...")
sleep(1)
- !! PUT:
+ say("PUT:")
say(put("https://httpbin.org/put", `{"key": "value"}`).body)
- !! Waiting 1sec...
+ say("Waiting 1sec...")
sleep(1)
- !! DELETE:
+ say("DELETE:")
say(delete("https://httpbin.org/delete").body)
diff --git a/examples/ini/ini.tm b/examples/ini/ini.tm
index d67dd0d5..cee33f3c 100644
--- a/examples/ini/ini.tm
+++ b/examples/ini/ini.tm
@@ -41,7 +41,7 @@ func main(path:Path, key:Text?):
data := parse_ini(path)
if keys.length < 1 or keys[1] == '*':
- !! $data
+ say("$data")
return
section := keys[1]:lower()
@@ -50,7 +50,7 @@ func main(path:Path, key:Text?):
Valid names: $\[1]$(", ":join([k:quoted() for k in data.keys]))$\[]
")
if keys.length < 2 or keys[2] == '*':
- !! $section_data
+ say("$section_data")
return
section_key := keys[2]:lower()
diff --git a/examples/learnxiny.tm b/examples/learnxiny.tm
index 7373f057..ecb1140f 100644
--- a/examples/learnxiny.tm
+++ b/examples/learnxiny.tm
@@ -9,9 +9,6 @@ func main():
# Print to the console
say("Hello world!")
- # You can also use !! as a shorthand:
- !! This is the same as using say(), but a bit easier to type
-
# Declare a variable with ':=' (the type is inferred to be integer)
my_variable := 123
diff --git a/examples/tomodeps/tomodeps.tm b/examples/tomodeps/tomodeps.tm
index 8c75173a..c6c2171e 100644
--- a/examples/tomodeps/tomodeps.tm
+++ b/examples/tomodeps/tomodeps.tm
@@ -13,7 +13,7 @@ enum Dependency(File(path:Path), Module(name:Text))
func _get_file_dependencies(file:Path -> {Dependency}):
if not file:is_file():
- !! Could not read file: $file
+ say("Could not read file: $file")
return {}
deps : @{Dependency} = @{}