From dbee5b9eabb5a85d95726b7c7453ca5016ba931a Mon Sep 17 00:00:00 2001 From: Garrit Franke Date: Wed, 9 Dec 2020 23:14:45 +0100 Subject: [PATCH] Add println function --- examples/greeter.sb | 2 +- lib/stdio.sb | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/greeter.sb b/examples/greeter.sb index 1c8a654..1888a78 100644 --- a/examples/greeter.sb +++ b/examples/greeter.sb @@ -4,4 +4,4 @@ fn main() { fn greet(name) { return "Hello " + name -} \ No newline at end of file +} diff --git a/lib/stdio.sb b/lib/stdio.sb index 720a7ee..34b0b7a 100644 --- a/lib/stdio.sb +++ b/lib/stdio.sb @@ -1,3 +1,10 @@ +// Raw wrapper around _printf builtin function. +// Writes the given content to stdout fn print(msg) { - _printf(msg + "\n") + _printf(msg) +} + +// Like print(), but with an extra newline ('\n') character +fn println(msg) { + print(msg + "\n") } \ No newline at end of file