Open In App

YAML Comments

Last Updated : 14 Dec, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

YAML_Comments

Comments are used to prevent the execution of statements. Comments are ignored while the compiler executes the code. Comments are user-friendly as user can get explanations of code using comments.

Since you are alright with the sentence structure and fundamentals of YAML, let us continue further into its details. In this part, we will perceive how to utilize comment in YAML. Comment are utilized to depict meaningful message about life of code.  

There are two kinds of Comments.  

  1. Inline or single line comment
  2. Block level comment

YAML has the language structure uphold for inline remarks, yet not for block level Comment  

Inline comment: Inline comments are remarks proclaimed at the line of code, Hashtag image is utilized toward the beginning of the line to tell processor that it is comment.

Example:

# remarks Punctuation model in YAML document  
or
#### #### comment model

These just determines as single line Comments. Each line of comment begins with hashtag image and clear space followed by portrayal. Each line ends with new line break.  

Block level Comment: Square Comments are to remark the various lines. YAML has no help for block Comment naturally, you can utilize numerous inline Comment  

# block level Comment model  
# Comment line 1  
# Comment line 2  
# Comment  line 3

Significant notes of Comment in YAML: Comments are disregarded by yaml processor. It is helpful to report about the line of code, empowers designers life is straightforward, help easy route orders by various IDE

YAML underpins single line comment. Its structure is clarified beneath with the assistance of a model −

# This is single line comment.

Highlights of comments: The highlights of comments in YAML are given underneath –

  • A commented block is skipped during the execution of code.
  • Comments help to add portrayal for determined code block.
  • Comments must not show up inside scalars.

YAML does exclude any approach to get away from the hash image (#) so inside multi-line string it is highly unlikely to isolate the comment from the crude string esteem.

Example:

#comment 1
- Value line 1

#comment 2
- value line 2

#comment 3
- value line 3

The alternate way key mix for commenting YAML blocks is Ctrl+Q.

Note: The similar advances are suitable on the off chance. It is constantly prescribed to utilize Superb Word processor for making YAML documents as it upheld by most working frameworks and incorporates engineer neighborly easy route keys.


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads