Processing Data - Operators and Expressions
01-Introduction
In real life, when we go shopping at a supermarket, we calculate the total price by summing up the unit prices of all items purchased.
This is the process of transforming input data into the data we want.
In this lesson, we'll introduce how to process data.
02-Answer to Previous Exercise
Define 4 variables: age=18, name=BinaryBang, workExperience="10 years programming experience", favLanguage=["C,Cpp,Oc,Java,Arkts,Cangjie"]
Output a self-introduction template: "Hello everyone, I'm xxx, x years old, with xxx work experience, my favorite programming languages are: xxx";
03-Operators
Operators are the foundation of expressions.
What are operators?
Operators express the operations performed on input data.
Common operators:
Assignment operators
Arithmetic operators
+
/
%
Logical operators
!
||
&&
Compound expressions
+=
-=
*=
/=
%=
04-Expressions
What are expressions?
Any language element that can be evaluated is an expression.
01-Arithmetic expressions
Expressions composed of arithmetic operators.
Precedence
Associativity
For detailed information, check the table:
https://docs.cangjie-lang.cn/docs/1.0.0/user_manual/source_zh_cn/Appendix/operator.html
if expressions
while expressions
for-in expressions
05-Input Functions
Introduction and usage of readln
06-Exercise
Input weight, height, and gender, calculate BMI value, and output whether your BMI is normal.
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讲,先看看适不适合自己

