Posts

Showing posts with the label YAML Basics

YAML Basics

Image
YAML is a human-readable data serialization language that is often used for writing configuration files. Scalars and Basic Data Types In YAML, scalars represent simple data types like strings, numbers, booleans, and null. Let's start with these basic data types. Strings: Strings are sequences of characters and don't require quotes unless they contain special characters or spaces. Examples: name: John Doe email: john@example.com message: "Hello, World!" Numbers: Numeric values can be integers or floating-point numbers. Examples: age: 30 pi: 3.14159 Booleans: Booleans represent true or false values. Examples: is_student: true has_car: false Null: The keyword null represents the absence of a value. Example: description: null Lists and Sequences Lists in YAML are used to represent sequences of items. Each item is preceded by a hyphen ( - ) followed by a space. Lists: Examples: fruits: - apple - banana - orange Nested Lists: Lists can be nested to create more comple