Explain the Block scalar Styles in YAML?

Category: YAMLExplain the Block scalar Styles in YAML?
Editor">Editor Staff asked 2 years ago

Explain the Block scalar Styles in YAML?

1 Answers
Editor">Editor Staff answered 2 years ago

Block Styles
YAML consists of different types such as scalars, collections, sequences and mappings.
In Block scalar style, multi-line strings can be written in two types such as block notation which uses a literal style, indicated by (“|”) and folded style, indicated by (“>”).

  • In block notation, each line break (means where text is divided into 2 lines) is preserved.
  • In folded style each line break is turned into a space, if it is an empty line or more-intended line

Block Style
Example of Block notation
 — |welcome to fresco playhi, this is yaml courseyou are in scalar topic
Example of Folded style
— >  In tcs there are several learning resources         like fresco play, skill soft, safari and lynda.                  Now you are          learning YAML course                  congratulations!