added return type to function

This commit is contained in:
Sven Heidemann
2020-05-25 16:36:44 +02:00
parent 38353246b2
commit b9e938f8a1
15 changed files with 74 additions and 48 deletions

View File

@@ -4,11 +4,11 @@ use test2 as test3 from Tests;
lib Main {
class Program {
func Main(args: list): void {
test_a = test1();
var test_a: test1 = test1();
test_a.dec_vars();
test_a.is_error();
if (!error) {
test_b = test3();
var test_b: test3 = test3();
test3.continue();
}
}

View File

@@ -3,22 +3,22 @@ lib Tests
/*
declaration of some tests
*/
export class test1
public class test1
{
export test_string: string = 'Hello';
export test_string_2: string = "Hello World";
export test_num: num = 1;
export test_num_2: num = 1.0;
export test_num_3: num = this.test_num + this.test_num_2;
public var test_string: string = 'Hello';
public var test_string_2: string = "Hello World";
public var test_num: num = 1;
public var test_num_2: num = 1.0;
public var test_num_3: num = this.test_num + this.test_num_2;
export func dec_vars(): void
public func dec_vars(): void
{
test_bool: bool = true;
test_bool_2: bool = false;
test_bool_3: bool = test_bool != test_bool_2; # true
var test_bool: bool = true;
var test_bool_2: bool = false;
var test_bool_3: bool = test_bool != test_bool_2; # true
}
export is_error(): bool
public is_error(): bool
{
if (error != empty)
{

View File

@@ -1,12 +1,12 @@
lib Tests {
export class test2 {
public class test2 {
string_a = string1();
export func continue() {
public func continue() {
input(string_a.string1 + ': ');
}
}
class strings {
public string1 = "hello world";
var public string1 = "hello world";
}
}

View File

@@ -6,15 +6,15 @@
lib Main {
class Program {
func Main() {
testBool: bool;
testEmpty: emptyType = empty;
testNum: number = 3.0;
testBool_2: bool = 3 > 1;
func Main(): void {
var testBool: bool;
var testEmpty: emptyType = empty;
var testNum: number = 3.0;
var testBool_2: bool = 3 > 1;
output('Hello World');
output(66);
output(3 + 3);
test: string = input('# ');
var test: string = input('# ');
output(test);
output(false);
@@ -25,7 +25,7 @@ lib Main {
}
# public func test1234(param: list) {
public func test1234()
public func test1234(): void
{
/*for i in range(0, length(param)) {
output(i);