Data types represent various kinds of data
Scalars Data Types
- represent a single individual values represent in the format of key and value. scalar represents a single stored value. The value data type can be anything, it can be a String, or it can be a float or number or boolean. It can be anything
- String
- support alphanumerical values
- name: Deepak Talwar
- Plain State approach without any type of quotes
- There are no quotes approach you need to use in the scenarios.
- Where your string does not have any special characters, spaces, or any reserved keywords that can be misinterpreted by the YAML parser.
- Single Quote / Double Quote approach
- Where we have special characters like comma, exclamatory mark and there is a space.
- Whenever we are using reserved keywords.
- + with Double Quotes
- Single Quote will not interpret the escape sequence characters like \n, \t, \"". Double quotes does.
- There are no quotes approach you need to use in the scenarios.
- Plain State approach without any type of quotes
- Number
- support integer and decimal values
- Boolean
- support true or false values
- Date & Time
- support date value or date and time values
- Hexa Decimal value
- whenever something is starting with 0x, that is going to be considered as a hexadecimal
- When YAML parser try to parse this value, it is going to be converted into the corresponding decimal value.
- Octal Value
- Infinity
- d
- Invalid Number / NAN
- Null
- represent no value
- Binary
- represent byte data like images data.
- Long strings or multi-line strings inside the YAML files
- The special characters, such as the pipe symbol and the greater than symbol can be used to define a multi-line strings.
- Handle Line Break with in the String
- Literal Block
- The colon must be followed by a space after the key. The pipe symbol must be mentioned after the space. After referencing the pipe symbol, it is necessary to proceed to the next line and provide either a single space or a tap space.
- After granting this space, provide your value using multiple lines. Therefore, whenever the pipe symbol is employed, It will maintain all of the line breaks that you have specified within your multi-line string.
- Folded Block
- define a multi-string or an extended string, call this technique as the "folded block style. One of the reasons this method is referred to as "folded block" is that it will collapse all of your multiple lines. Convert a string value to a single line. It will not maintain any line breaks within the string.
- Literal Block
- Handle Line Breaks after the string
- All 4 line breaks are sustain between 2 string
- Remove all line breaks between 2 strings
- Default behavior if neither + or - used
- Show only single line break between 2 strings
- All 4 line breaks are sustain between 2 string