From db3809488805fbdcd9d726d9ed45ad7335812bd1 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Fri, 1 May 2026 22:43:13 +0300 Subject: remove examples in favour of tests + Might come up with proper examples at some point, but for now tests at least tell us if they're broken --- examples/guard.fwd | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 examples/guard.fwd (limited to 'examples/guard.fwd') diff --git a/examples/guard.fwd b/examples/guard.fwd deleted file mode 100644 index df42ef3..0000000 --- a/examples/guard.fwd +++ /dev/null @@ -1,40 +0,0 @@ -/* 'auto' is a special type that currently is in place of generics, will - * eventually be replaced but this is good enough to play around with */ -fwd_println(auto s); - -/* this is a hack, just creates two copies of whatever is passed to it. - * Primitive types should probably be excluded from the move checking, and more - * complex types would presumably implement some kind of .copy(), but at the - * moment that's still TODO */ -fwd_copy(auto n, (auto, auto) n1); - -guard(bool cond, () err, () ok) -{ - if cond { - err(); - } else { - ok(); - } -} - -try_print_one(int a) -{ - fwd_copy(a) => int a1, int a2; - guard(a1 < 1) => { - fwd_println("smaller than 1"); - } => ; - - fwd_copy(a2) => int a3, int a4; - guard(a3 > 1) => { - fwd_println("larger than 1"); - } => ; - - fwd_println(a4); -} - -main() -{ - try_print_one(0); - try_print_one(1); - try_print_one(2); -} -- cgit v1.2.3