arkts-basic-syntax-demo:基于HarmonyOS的ArkTS基础语法示例项目

ArkTS基础语法示例

Branch2Tags0
FilesLast commitLast 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

  1. Open BasicPage.ets to view the sample code for basic ArkTS syntax. Refresh the Previewer and view the printed result in the logs.
  2. Open BubbleSortPage.ets, refresh the Previewer, and view the bubble sort result in the logs.
  3. Open DaffodilsNumberPage.ets, refresh the Previewer, and view the three-digit daffodil numbers in the logs.
  4. 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

  1. This sample can only run on the Previewer.

  2. The HarmonyOS version must be HarmonyOS 5.0.5 Release or later.

  3. The DevEco Studio version must be DevEco Studio 6.0.2 Release or later.

  4. The HarmonyOS SDK version must be HarmonyOS 6.0.2 Release SDK or later.