BM: Baca dalam Bahasa Melayu
World D0: Start Here
YAML part 2: nesting and traps
You will learn: how spaces put YAML lines inside each other, and how to dodge tabs, lost zeros and sneaky true values.
Checked with Docker Engine 29 on 31 Oct 2026
The problem
One invisible tab broke a whole file. That is the real message. In plain words: line 3 starts with a tab, and YAML allows only spaces.
Watch
A tiffin carrier stacks bowls inside one carrier. YAML stacks with spaces. Two more spaces mean “inside the line above”. This is nesting: A box inside a box. In YAML, two more spaces put a line inside the line above..
Change chicken curry to rendang. See where it lives in the box.
How a computer reads it
- tiffinmap · 3 keys
- topricetext
- middlechicken currytext
- bottomlist · 2 items
- item 1eggtext
- item 2cucumbertext
Predict
The bottom: line and its list move 2 spaces left. Now bottom: lines up with tiffin:. Where does it end up?
Pick one answer.
Try it
Line 3 is one space short. Read the box: the reader’s real words, then plain words. Line it up. On a phone, use “Add a space”.
Put middle back inside the tiffin.
How a computer reads it
yaml: line 2: did not find expected key
In plain words: Line 3 isn't lined up. Match the keys next to it.
Watch
Most YAML bugs come from a few sneaky traps. Fine, or a trap? Sort them.
Drag a card into a box. Or tap the card, then tap the box.
Try it
Look at the box: the reader sees a number, 123456789. The first 0 is gone! Phone numbers are text. Quotes keep the 0.
Make the phone number text again.
How a computer reads it
- nameKedai Kanciltext
- phone123456789number
- opentruetrue/false
Check
spicy: yes. Kubernetes reads that as true. How do you keep the word yes?
Pick one answer.
You did it!
You can now nest YAML with spaces and dodge its sneaky traps.
Go deeper (optional)
Tools use different YAML readers. Older readers (YAML 1.1) turn yes, no, on and off into true or false. Newer ones keep them as words. Quotes are safe everywhere.
Real rep (optional): in your code editor, turn on “show whitespace”. Tabs and spaces look different then. Open a YAML file and check it.
Bahasa Melayu
Satu tab yang tak nampak rosakkan seluruh fail. Itulah mesej sebenar. Dalam bahasa mudah: baris 3 mula dengan tab, dan YAML hanya terima ruang.
Mangkuk tingkat susun mangkuk dalam satu bekas. YAML susun dengan ruang. Dua ruang lagi bermaksud “di dalam baris atasnya”. Inilah nesting (bersarang).
Baris bottom: dan senarainya beralih 2 ruang ke kiri. Kini bottom: sebaris dengan tiffin:. Ia ke mana?
Baris 3 kurang satu ruang. Baca kotak itu: kata-kata sebenar pembaca YAML, kemudian bahasa mudah. Luruskan ia. Di telefon, guna “Tambah satu ruang”.
Kebanyakan bug YAML datang daripada beberapa perangkap licik. Okey, atau perangkap? Susun semuanya.
Tengok kotak itu: pembaca nampak nombor, 123456789. Sifar pertama hilang! Nombor telefon ialah teks. Tanda petik kekalkan sifar itu.
spicy: yes. Kubernetes baca itu sebagai true. Macam mana nak kekalkan perkataan yes?
Kini anda boleh susun YAML bersarang dengan ruang dan elak perangkap liciknya.
You finished this before. Practice is always welcome!
Official docs: YAML 1.2 spec · Compose file reference · Kubernetes objects in YAML
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?