


























ArkTS 基于 Typescript 语言扩展,强制使用静态类型,基于性能考虑增加更多约束机制。
// 变量声明
let hi: string = 'hello';
// 常量声明
const hello: string = 'hello';
// 类定义
class Person {
name: string = '';
age: number = 0;
constructor(n: string, a: number) {
this.name = n;
this.age = a;
}
getName(): string {
returnthis.name;
}
}
let p1 = new Person('Alice', 25);
@Component
@Entry
class HelloWorld {
build() {}
}

此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。