ArkTS基础语法示例
| Files | Last commit | Last update |
|---|---|---|
| 11 months ago | ||
| 11 months ago | ||
| 11 months ago | ||
| 11 months ago | ||
| 9 months ago | ||
| 9 months ago | ||
| 9 months ago | ||
| 11 months ago | ||
| 11 months ago |
Basic ArkTS Syntax
Overview
This codelab introduces basic ArkTS syntax, helping beginners grasp core concepts including variable declarations, data types, statements, and functions, and apply them to implement basic algorithms.
Effect
N/A
How to Use
- Open BasicPage.ets to view the sample code for basic ArkTS syntax. Refresh the Previewer and view the printed result in the logs.
- Open BubbleSortPage.ets, refresh the Previewer, and view the bubble sort result in the logs.
- Open DaffodilsNumberPage.ets, refresh the Previewer, and view the three-digit daffodil numbers in the logs.
- Open MultiplicationTablePage.ets, refresh the Previewer, and view the nine-nine multiplication table in the logs.
Project Directory
├──entry/src/main/ets/
│ ├──entryability
│ │ └──EntryAbility.ets
│ ├──entrybackupability
│ │ └──EntryBackupAbility.ets
│ └──pages
│ ├──BasicPage.ets // Basic ArkTS syntax examples
│ ├──BubbleSortPage.ets // Bubble sort implementation
│ ├──DaffodilsNumberPage.ets // Daffodil number printing
│ └──MultiplicationTablePage.ets // Nine-nine multiplication table printing
└───entry/src/main/resources // Application resources
Required Permissions
N/A
Constraints
-
This sample can only run on the Previewer.
-
The HarmonyOS version must be HarmonyOS 5.0.5 Release or later.
-
The DevEco Studio version must be DevEco Studio 6.0.2 Release or later.
-
The HarmonyOS SDK version must be HarmonyOS 6.0.2 Release SDK or later.