48 lines
744 B
Plaintext
48 lines
744 B
Plaintext
|
|
|
|
|
|
let a: i32 = 1
|
|
const b: i32 = 2
|
|
let m:any = {
|
|
a:6,
|
|
b:9,
|
|
c: {
|
|
d:9
|
|
}
|
|
}
|
|
let a1:i32[] = [1,2,2,3]
|
|
|
|
func test(msg: i32): i32 {
|
|
print("a is 1")
|
|
return 0
|
|
}
|
|
|
|
@test(debug=6)
|
|
func add(a: i32, b: i32):i32 {
|
|
return a + b;
|
|
}
|
|
|
|
// 冒泡排序
|
|
func bubbleSort(arr: array, n: i32): void {
|
|
for(let i:i32 = 0; i < n-1; i++) {
|
|
for (let j:i32 = 0; j < n-i-1; j++) {
|
|
if (arr[j] > arr[j+1]) {
|
|
let temp = arr[j];
|
|
arr[j] = arr[j+1];
|
|
arr[j+1] = temp;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
let arr: i32[] = [64, 34, 25, 12, 22, 11, 90];
|
|
let b1:i32 = 4, c:i32 = 5;
|
|
|
|
@test(debug=6)
|
|
@debug(a=1,4)
|
|
func add1(a: i32, b: i32[]):i32[] {
|
|
return a + b;
|
|
}
|
|
print("hi");
|
|
|