From 5e5917104edaf0e7b2fdb0fe91d3e7f9166bda23 Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Thu, 6 Jun 2024 14:40:14 -0500 Subject: [PATCH] Add note about comparing collections --- .../About/about_Comparison_Operators.md | 12 ++++++++---- .../About/about_Comparison_Operators.md | 12 ++++++++---- .../About/about_Comparison_Operators.md | 12 ++++++++---- .../About/about_Comparison_Operators.md | 12 ++++++++---- 4 files changed, 32 insertions(+), 16 deletions(-) diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md index 45b7f9333ec1..1294bdde2b6b 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md @@ -1,7 +1,7 @@ --- description: Describes the operators that compare values in PowerShell. Locale: en-US -ms.date: 01/19/2024 +ms.date: 06/06/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comparison_operators?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Comparison Operators @@ -65,9 +65,13 @@ case-insensitive comparisons. The comparisons are between unicode code points and don't use culture-specific collation ordering. The results are the same regardless of the current culture. -When the input of an operator is a [scalar][15] value, the operator returns a -**Boolean** value. When the input is a collection, the operator returns the -elements of the collection that match the right-hand value of the expression. +When the left-hand value in the comparison expression is a [scalar][15] value, +the operator returns a **Boolean** value. When the left-hand value in the +expression is a collection, the operator returns the elements of the collection +that match the right-hand value of the expression. Right-hand values are always +treated as singleton instances, even when they're collections. The comparison +operators can't effectively compare collections to collections. + If there are no matches in the collection, comparison operators return an empty array. For example: diff --git a/reference/7.2/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md b/reference/7.2/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md index c6824c68a477..bc300474553b 100644 --- a/reference/7.2/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md +++ b/reference/7.2/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md @@ -1,7 +1,7 @@ --- description: Describes the operators that compare values in PowerShell. Locale: en-US -ms.date: 01/19/2024 +ms.date: 06/06/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comparison_operators?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Comparison Operators @@ -65,9 +65,13 @@ case-insensitive comparisons. The comparisons are between unicode code points and don't use culture-specific collation ordering. The results are the same regardless of the current culture. -When the input of an operator is a [scalar][15] value, the operator returns a -**Boolean** value. When the input is a collection, the operator returns the -elements of the collection that match the right-hand value of the expression. +When the left-hand value in the comparison expression is a [scalar][15] value, +the operator returns a **Boolean** value. When the left-hand value in the +expression is a collection, the operator returns the elements of the collection +that match the right-hand value of the expression. Right-hand values are always +treated as singleton instances, even when they're collections. The comparison +operators can't effectively compare collections to collections. + If there are no matches in the collection, comparison operators return an empty array. For example: diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md index 156633c0d263..606e4a5f349c 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md @@ -1,7 +1,7 @@ --- description: Describes the operators that compare values in PowerShell. Locale: en-US -ms.date: 01/19/2024 +ms.date: 06/06/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comparison_operators?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Comparison Operators @@ -65,9 +65,13 @@ case-insensitive comparisons. The comparisons are between unicode code points and don't use culture-specific collation ordering. The results are the same regardless of the current culture. -When the input of an operator is a [scalar][15] value, the operator returns a -**Boolean** value. When the input is a collection, the operator returns the -elements of the collection that match the right-hand value of the expression. +When the left-hand value in the comparison expression is a [scalar][15] value, +the operator returns a **Boolean** value. When the left-hand value in the +expression is a collection, the operator returns the elements of the collection +that match the right-hand value of the expression. Right-hand values are always +treated as singleton instances, even when they're collections. The comparison +operators can't effectively compare collections to collections. + If there are no matches in the collection, comparison operators return an empty array. For example: diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md index 915116196075..4710a735643d 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md @@ -1,7 +1,7 @@ --- description: Describes the operators that compare values in PowerShell. Locale: en-US -ms.date: 01/19/2024 +ms.date: 06/06/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comparison_operators?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Comparison Operators @@ -65,9 +65,13 @@ case-insensitive comparisons. The comparisons are between unicode code points and don't use culture-specific collation ordering. The results are the same regardless of the current culture. -When the input of an operator is a [scalar][15] value, the operator returns a -**Boolean** value. When the input is a collection, the operator returns the -elements of the collection that match the right-hand value of the expression. +When the left-hand value in the comparison expression is a [scalar][15] value, +the operator returns a **Boolean** value. When the left-hand value in the +expression is a collection, the operator returns the elements of the collection +that match the right-hand value of the expression. Right-hand values are always +treated as singleton instances, even when they're collections. The comparison +operators can't effectively compare collections to collections. + If there are no matches in the collection, comparison operators return an empty array. For example: