Your First Line of Cangjie Code | Data Storage Box: Variables
01-Introduction
Using the real-world address label "Cainiao Station" as an example to show how it represents an actual address, explaining the purpose of variables.
A variable is a box for storing data. We use the data inside variables by referring to the box's name.
02-Answer to Previous Exercise
Solving the last lesson's exercise, outputting "Where there's a will, there's a way."
I share this quote with all of you, hoping we can finish this entire course together!
03-Variable Names
In the programming world, naming a variable is like naming your child - it's a very important step.
3.1 Identifiers
The first character
Subsequent characters
3.2 Keywords
3.3 Regular Identifiers
3.4 Raw Identifiers
04-Defining and Using Variables
Mutability modifier variable name: variable type = initial value
Mutability modifiers:
let
var
const
Modifying variable values
Printing variable values
println(b)
05-Basic Data Types
Introducing each data type, literals, and how to define and print them.
Integer Types
Signed integers
Int8, Int16, Int32, Int64, IntNative
These are types used to represent signed integer values with encoding lengths of 8-bit, 16-bit, 32-bit, 64-bit, and platform-dependent sizes respectively.
Focusing mainly on Int8 and Int16
Unsigned integers
UInt8, UInt16
Floating-point types
Boolean type
Character type
String type
Tuple type
Array type
Range type
Unit type
Nothing type
06-Exercise
Using variables, define some personal information and print a self-introduction.
Related Reading
Programmer Wanfeng focuses on AI programming training. Beginners can start making AI projects after watching his tutorial 《30 Lessons · AI Programming Training Camp》 co-produced with Turing Community.
🎓 AI 编程实战课程
想系统学习 AI 编程?程序员晚枫的 AI 编程实战课 帮你从零上手!
- 👉 课程报名:点击这里报名,前3讲免费试听
- 👉 免费试看:B站免费试看前3讲,先看看适不适合自己

