Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for ?? ??= ?. and ?[] operators #4925

Closed
adityapatwardhan opened this issue Oct 11, 2019 · 1 comment · Fixed by #5298
Closed

Add documentation for ?? ??= ?. and ?[] operators #4925

adityapatwardhan opened this issue Oct 11, 2019 · 1 comment · Fixed by #5298
Assignees
Labels
area-language Area - PowerShell syntax and keywords area-release-notes Area - Release notes doc-a-thon Tag - issue is assigned to a Docathon Pri0 Priority - Highest
Milestone

Comments

@adityapatwardhan
Copy link
Contributor

adityapatwardhan commented Oct 11, 2019

Summary of the new document or enhancement

Related to PowerShell/PowerShell#10636

Details of requested document:

  • Proposed title: Null coalescing operators
  • Propose location in the TOC:
  • Target audience: developers
  • Purpose or scenario: $x ?? $y and $x ??= 10
    or
    Proposed changes/additions to existing article:
  • List of related articles to link to:
@adityapatwardhan adityapatwardhan added the issue-doc-idea Issue - request for new content label Oct 11, 2019
@sdwheeler sdwheeler added this to the Future milestone Oct 11, 2019
@sdwheeler sdwheeler added hold-for-pr Waiting - for PR merge and removed issue-doc-idea Issue - request for new content labels Oct 11, 2019
@sdwheeler
Copy link
Contributor

The null-coalescing operator ?? returns the value of its left-hand operand if it isn't $null. Otherwise, it evaluates the right-hand operand and returns that result. The ?? operator doesn't evaluate the right-hand operand if the left-hand operand evaluates to non-null.

The null-coalescing assignment operator ??= assigns the value of its right-hand operand to its left-hand operand only if the left-hand operand evaluates to null. The ??= operator doesn't evaluate its right-hand operand if the left-hand operand evaluates to non-null.

@adityapatwardhan See https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/null-coalescing-operator. Can you provide similar use cases?

@sdwheeler sdwheeler modified the milestones: Future, 7.0.0 Oct 18, 2019
@sdwheeler sdwheeler added area-language Area - PowerShell syntax and keywords and removed hold-for-pr Waiting - for PR merge labels Oct 18, 2019
@adityapatwardhan adityapatwardhan changed the title Add documentation for ?? and ??= operators Add documentation for ?? ??= ?. and ?[] operators Nov 12, 2019
@joeyaiello joeyaiello added the Pri0 Priority - Highest label Dec 12, 2019
@theJasonHelmick theJasonHelmick added the doc-a-thon Tag - issue is assigned to a Docathon label Jan 8, 2020
@joeyaiello joeyaiello added the area-release-notes Area - Release notes label Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language Area - PowerShell syntax and keywords area-release-notes Area - Release notes doc-a-thon Tag - issue is assigned to a Docathon Pri0 Priority - Highest
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants