From 31637af96ec7555b81e742114ff41d80f37e3e6b Mon Sep 17 00:00:00 2001 From: A404M Date: Thu, 29 May 2025 22:17:48 +0330 Subject: better anytype --- code/main.felan | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'code/main.felan') diff --git a/code/main.felan b/code/main.felan index 8b5903e..d629a26 100644 --- a/code/main.felan +++ b/code/main.felan @@ -1,12 +1,28 @@ @import("lib/operator.felan"); +/* print :: (value:anytype) -> void { - if @type_of(value) == u8 { + if comptime @type_of(value) == u8 { @putc(value); + }else{ + @putc('h'); + } +}; +*/ + +print :: (value:*anytype)->void{ + if comptime @type_of(value.*) == u8 { + @putc(value.*); + }else{ + @putc('h'); } }; main :: ()->void{ - print('a'); + a := 'a'; + b := 123; + print(&a); + print(&b); + // print(123); }; -- cgit v1.2.3