Update examples

This commit is contained in:
apio 2022-08-25 10:01:14 +02:00
parent d341e90237
commit d0c219e839
7 changed files with 28 additions and 29 deletions

View File

@ -1,5 +1,5 @@
import core/flow;
const { exit } from @'core/os';
@main {
flow.exit(1);
let @main in {
exit(1);
}

View File

@ -1,10 +1,10 @@
import core/io;
import core/fs;
const io from @'core/io';
const { open } from @'core/fs';
@main {
io.out('What\'s your name? ');
str name = io.in();
fs.File nameFile = fs.open('name.txt');
nameFile.write(name);
nameFile.close();
let @main in {
io.out("What is your name? ");
let name = io.in();
let file = open("name.txt");
file.write(name);
file.close();
}

View File

@ -1,8 +1,9 @@
import core/io;
import core/string;
const io from @'core/io';
const { concat } from @'core/string';
const { toString } from @'core/float_utils';
@main {
f128 float1 = 234.6;
f128 float2 = 2934748348291930404.5;
io.outln(string.concat('Result is: ',(str)(float1 + float2)));
let @main in {
let float1 : f128 = 234.6;
f128 float2 : f128 = 2934748348291930404.5;
io.outln(concat('Result is: ',toString(float1 + float2)));
}

View File

@ -1,5 +1,5 @@
import core/io;
const io from @'core/io';
@main {
let @main in {
io.outln('Hello world!');
}

View File

@ -1,8 +1,8 @@
import core/io;
const io from @'core/io';
@main {
let @main in {
io.out('What\'s your name? ');
str name = io.in();
let name = io.in();
io.out('Hello, ');
io.out(name);
io.out('!!');

View File

@ -1,12 +1,10 @@
let { io } in @'core/io';
const { io } from @'core/io';
let good_food : String = 'watermelon';
const good_food : String = 'watermelon';
let @main : i32 in {
let @main in {
io.outln('Hello world!');
io.outf('My favorite food is %s\n',good_food);
return 0;
}

View File

@ -1,7 +1,7 @@
import core/io;
const io from @'core/io';
@main {
i32 age = 64;
let age : i32 = 64;
io.out('I am ');
io.out(age);
io.outln(' years old.');