From ab832419702bd28e9b59a9fce169114384a43d88 Mon Sep 17 00:00:00 2001 From: A404M Date: Wed, 23 Apr 2025 12:37:28 +0330 Subject: prepairing stuff for import in codes --- code/basic.felan | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 code/basic.felan (limited to 'code/basic.felan') diff --git a/code/basic.felan b/code/basic.felan new file mode 100644 index 0000000..9d93ef8 --- /dev/null +++ b/code/basic.felan @@ -0,0 +1,40 @@ +string :: []u8; + +print :: (value:[]u8)->void{ + i :u64= 0; + while i < value.length { + putc value[i]; + i += 1; + } +}; + +print :: (value:u64)->void{ + value := value; + result :[20]u8 = undefined; + i := 0; + while { + result[i] = '0' + @cast(value % 10,u8); + i += 1; + value /= 10; + value != 0; + } {} + + j := 0; + while j < i { + putc result[j]; + j += 1; + } +}; + +to_u64 :: (value:string) -> u64 { + i := value.length; + result :u64= 0; + + while i > 0 { + c := value[i-1]; + result *= 10; + result += @cast(c - '0',u64); + i -= 1; + } + return result; +}; -- cgit v1.2.3