From 9e41c91af315e9fef9468ea90123550093ca6ace Mon Sep 17 00:00:00 2001 From: Jack Delahunt <20085409@mail.wit.ie> Date: Sat, 14 May 2022 21:55:48 +0100 Subject: [PATCH] Updated README --- README.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 771f9c0f..f618bcb1 100644 --- a/README.md +++ b/README.md @@ -4,14 +4,8 @@ Liam is a strongly typed compiled language intended for performance comparable t ## Examples ### Hello world ```rust -fn print_string(s: string^): void { - // exact insertion into generated code - insert "println!(\"{}\", *s)"; -} - fn main(): void { - let s: string = "Hello world"; - print_string(@s); + print_string(@make_string(@"Hello world")); } ``` @@ -43,9 +37,9 @@ fn func_name(param: type): return_type {} ### For Loops ```rust -for ["car", "dog", "house"] { - print_u64(i); // generated index variable - i - print_string(it); // generated element variable - it +for str index in ["car", "dog", "house"] { + print_u64(index); + print_string(*str); } ``` @@ -57,6 +51,13 @@ struct struct_name { } ``` +### Conditionals +```rust +if condition or another_condition { + ... +} +``` + ### Array ```rust let arr : [type] = [...];