YMAL Crash Course

  1. Context :

YAML, short for “YAML Ain’t Markup Language,” has become the go-to format for writing clean, readable configuration files in modern development workflows. In this blog, we’ll explore the essential concepts of YAML — from its indentation-based syntax and data types to powerful features like anchors, aliases, and multi-line strings. Whether you're working with Docker, Kubernetes, GitHub Actions, or any DevOps tool, mastering YAML is a must. This guide is perfect for beginners and a great refresher for experienced developers looking to write more efficient and maintainable config files.


  1. YAML is used in tools like:

  • GitHub Actions

  • Docker Compose

  • Kubernetes (K8s)

  • Ansible

  • CI/CD pipelines


  1. Hands On:

# Basic syntax for YAML
name: "Ayush"
age: 27

# List (We have to make list with 1 tab)
languages:
  - JavaScript
  - Python
  - Go

# Dictionaries (List of users with name and role)
users:
  - name: AyushMon
    role: Admin

  - name: BiscuitMon
    role: user

# Data types: string, number, boolean, null
title: "yaml basics"
version: 1.0
active: true
description: null

# Multi-line (preserves newlines)
block: |
  this is 
  multiple line 
  code that we can use for multi-line purpose

# Folded style (converts to single line)
folded: >
  this is 
  single line 
  code that we can use for multi-line to single-line purpose

YMAL is space sensitive language. So let’s understand the basic syntax of it. In YMAL we write code like key: pair. see the Space in the sample snippet of the code.

In YMAL file We can make :

  1. Basic key value pair

  2. Lists

  3. Nested Lists ( dictionary)


  1. Important Jargons :

  • Indentation:

    For making the List , We have to use Indentation. Means “1 tab”. For making list that is Important. Example: name and age…

  • List:

    For making the list We use Indentation (1 tab) and then have to write - to make it. Example : Language

  • Nested list :

    It’s the combination of lists. In the List you want to make another list then Like make a list normal list ( “ indentation ” +” - ” ). In That to write any Property we have to use 2 indentation ( 2 tabs ). Example ; role.

  • Multiple and single line :

    1. Multiple line are we written with “ | “ + after enter + 1 indentation + then multiple lines.

    2. For single/folded line use “ > “ and rest of things are same.


Conclusion :

YAML is a simple yet powerful format essential for clean and readable configuration across modern development tools.

CTA: ⭐ Star this repo and try writing your own YAML files — it's easier than you think!


0
Subscribe to my newsletter

Read articles from the_OldSchool_coder directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

the_OldSchool_coder
the_OldSchool_coder

I am a passionate full-stack web developer with expertise in designing, developing, and maintaining scalable web applications. With a strong foundation in both front-end and back-end technologies, I specialize in creating dynamic user experiences and robust server-side solutions. Proficient in modern frameworks like React, Angular, Node.js, and Django, I thrive on crafting efficient, clean code and optimizing performance. Whether building RESTful APIs, designing responsive interfaces, or deploying applications to the cloud, I bring a results-driven approach to every project.Let me know if you'd like to customize it further, perhaps including your specialties or experience level!