Skip to content

Commit 5390942

Browse files
norwdcmwilson21jc-clark
authored
Add explanation of ordinal comparison of strings using the < and > operators (#25870)
Co-authored-by: Courtney Wilson <[email protected]> Co-authored-by: Joe Clark <[email protected]>
1 parent 4aca5d2 commit 5390942

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

content/actions/learn-github-actions/expressions.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ You can use expressions to programmatically set environment variables in workflo
1717

1818
Expressions are commonly used with the conditional `if` keyword in a workflow file to determine whether a step should run. When an `if` conditional is `true`, the step will run.
1919

20-
You need to use specific syntax to tell {% data variables.product.prodname_dotcom %} to evaluate an expression rather than treat it as a string.
20+
{% data reusables.actions.expressions-syntax-evaluation %}
2121

2222
{% raw %}
2323
`${{ <expression> }}`
@@ -80,7 +80,7 @@ env:
8080
| Operator | Description |
8181
| --- | --- |
8282
| `( )` | Logical grouping |
83-
| `[ ]` | Index
83+
| `[ ]` | Index |
8484
| `.` | Property de-reference |
8585
| `!` | Not |
8686
| `<` | Less than |
@@ -92,6 +92,16 @@ env:
9292
| `&&` | And |
9393
| <code>\|\|</code> | Or |
9494

95+
{% note %}
96+
97+
**Notes:**
98+
- {% data variables.product.company_short %} ignores case when comparing strings.
99+
- `steps.<step_id>.outputs.<output_name>` evaluates as a string. {% data reusables.actions.expressions-syntax-evaluation %} For more information, see "[AUTOTITLE](/actions/learn-github-actions/contexts#steps-context)."
100+
- {% data reusables.actions.expression-syntax-if %} For more information about `if` conditionals, see "[AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idif)."
101+
- For numerical comparison, the `fromJSON()` function can be used to convert a string to a number. For more information on the `fromJSON()` function, see "[fromJSON](#fromjson)."
102+
103+
{% endnote %}
104+
95105
{% data variables.product.prodname_dotcom %} performs loose equality comparisons.
96106

97107
- If the types do not match, {% data variables.product.prodname_dotcom %} coerces the type to a number. {% data variables.product.prodname_dotcom %} casts data types to a number using these conversions:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
You need to use specific syntax to tell {% data variables.product.prodname_dotcom %} to evaluate an expression rather than treat it as a string.

0 commit comments

Comments
 (0)