Skip to content

Example for here-string in About_Quoting_Rules could be better #10452

@jsilverm

Description

@jsilverm

Prerequisites

  • Existing Issue: Search the existing issues for this repository. If there is an issue that fits your needs do not file a new one. Subscribe, react, or comment on that issue instead.
  • Descriptive Title: Write the title for this issue as a short synopsis. If possible, provide context. For example, "Typo in Get-Foo cmdlet" instead of "Typo."
  • Verify Version: If there is a mismatch between documentation and the behavior on your system, ensure that the version you are using is the same as the documentation. Check this box if they match or the issue you are reporting is not version specific.

Links

https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_quoting_rules?view=powershell-7.3

Summary

The following example given here seems slightly pointless -- I see no benefit of using a "here-string" at all as the same content would go just fine in a double-quoted string:

Using a here-string can simplify using a string in a command. For example:
@"
Use a quotation mark (') to begin a string.
"@

That seems like a pointless waste of here-string, but if it is buying us something I don't see what it is. At least if there were a " embedded it would be saving us from using a ` or doubling the "

Details

There are numerous nice and easy ways to include literal " or ' characters in PowerShell.
Here-strings are also very useful.

I remember the first time I read this content I thought I was just missing something and I would come back to it later.
I came back to it. It still seems like overkill.

Here-string is somewhat an important part of this doc, should the short description of the topic mention them? I went back and forth, but probably the main reason I was re-reading this was that I was here for the here-string stuff.

Overall a nice doc of a nice aspect of PowerShell.

Suggested Fix

What seems to belong here is one of the shortest valuable usages of a here-string, whatever that might be.
Preferably something that would at least require an extra ` or a double character otherwise, but some other short useful use would be even better I think.

Metadata

Metadata

Labels

area-aboutArea - About_ topicsissue-doc-bugIssue - error in documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions