module main

// import moda

// import (
// 	modb
// 	modc
// )

fn main() {
	b := Bar{a: 122}
	mut a := Foo{
			a: 'hello'
			b: b
	}
	a.a = 'da'
	a.b.a = 111

	a1 := a.a
	a2 := b.testa()

	mut c := testa()
	c = 1
	mut d := testb(1)
	d = 'hello'

	mut e := 'hello'
	e = testb(111)
	e = 'world'

	mut f := [testa(),2,3,4]
	mut g := [testb(1),'hello']

	//mut arr_foo := []Foo
	arr_foo := [a]
	//arr_foo << a // TODO
	af_idx_el := arr_foo[0]
	foo_a := af_idx_el.a

	mut m1 := map[string]string
	mut m2 := {'v': 1, 'lang': 2}

	ma1, ma2 := 'hello', 'vlang'
	mr1, mr2 := mr_test()

	opt1, opt2, opt3, opt4 := 'opt1', optional_a(), 'opt3', optional_b()
	opt_mr1, opt_mr12 := optional_mr() or {
		// err
	}
}

fn mr_test() (int, string) {
	return 1,'v'
}

fn testa() int {
	return testc(1)
}

fn testb(a int) string {
	return 'hello'
}

fn testc(a int) int {
	return a
}

fn (f &Foo) testa() int {
	mut a := f.testb()
	a = 1
	return 4
}

fn (f &Foo) testb() int {
	return 4
}

fn (b &Bar) testa() int {
	return 4
}

struct Bar {
	a int
}

struct Foo{
	a string
	b Bar
}

fn optional_a() ?string {
	return '111'
}

fn optional_b() ?string {
	return '222'
}

fn optional_mr() ?(int, string) {
	return 1, '111'
}

