01-Introduction

Preparing lunch in daily life:

  1. Buy ingredients
  2. Prepare ingredients
  3. For each ingredient, process according to these conditions:
    3.1 If it's vegetables, stir-fry.
    3.2 If it's bones, make soup.
    3.3 If it's meat, steam.
  4. All ingredients processed

The flow described here includes sequence, loop, and condition.
Most tasks in daily life can be described using these three flows, and so can programs.

02-Answer to Previous Exercise

  1. First define an animal struct.
  2. Define different attributes for each.
  3. Read input and output function types.
  4. Based on different types, instantiate an animal variable and output animal information.

03-Sequence

fn MakeMilkTea() {
BoilWater(); // Step 1
AddTea(); // Step 2
AddMilk(); // Step 3
PourIntoCup(); // Step 4
}

04-Conditions

if-else, judgment
Pattern matching

05-Loops

for
while
continue
break

06-Exercise

Design a game to guess integers in the range [0-100].

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 编程实战课 帮你从零上手!