How do you comment out code in powershell

Like other languages powershell also supports single/Inline comments line and multi line comments.
Starting with PowerShell V1 there's only # to make the text after it a comment.
In PowerShell V2 "<# #>" can be used for block comments (multi-line) and more specifically for SYNOPSIS, DEsCRIPTION, NOTES, LINK help comments.

Example: Sinlgle/Inline comments

Example


# This is a single or inline comment starts with hash in Powershell

Copy and Try it

Example: Block comments (multi-line)

Example


    <# this is a first line of comment
       this is a second line of comment
       this is a third line of comment
       .
       .
       .
       this is a last line of comment
       #>

Copy and Try it

you can find best consolidated reference for comments for other programming languages http://en.wikipedia.org/wiki/Comparison_of_programming_languages_(syntax)#Comments