-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest1.crdm
More file actions
54 lines (36 loc) · 885 Bytes
/
test1.crdm
File metadata and controls
54 lines (36 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
public class Person(private name: string, private age: int) {
private:
address: string = "1 High Road";
public:
test: string = "hello";
getAddress() -> string {
return this.address;
}
birthday() -> int {
this.age += 1;
return this.age;
}
getName() -> string {
return this.name;
}
static:
hello: string = "Hello";
}
fn test<T>(x: T) -> T {
return x;
}
fn test2() {
return;
}
fn main() {
let p: Person = new Person("Ethan", 18);
// Pointer Arithmetic
let x: int = 1;
let z: &[int] = &[1, 2, 3];
let a: [int] = [1, 2, 3];
let b: &[fn(int) -> int];
let increment: fn(&int) -> void = |x| void -> { x += 1; };
let closure_ret_closure: fn() -> fn(&int) -> void = || fn(&int) -> void -> { return increment; };
closure_ret_closure()(1);
test<float>(1.1);
}