Skip to content

Commit f147aa5

Browse files
committed
update
1 parent e5e015e commit f147aa5

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

articles/azure-resource-manager/bicep/operators-access.md

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,13 @@ Output from the example:
7171

7272
## Reverse index accessor
7373

74-
Beginning with [Bicep CLI version 0.34.x](https://github.com/Azure/bicep/releases/tag/v0.34.1), the reverse index accessor operator (`^`) allows you to retrieve an element from an array or a character from a string by counting from the end. This one-based index means `^1` returns the last item, `^2` the second-to-last, and so on. The index must be a positive integer greater than zero and can be specified as a literal or an expression that evaluates to an integer.
74+
Beginning with [Bicep CLI version 0.34.x](https://github.com/Azure/bicep/releases/tag/v0.34.1), the reverse index accessor operator (`^`) allows you to retrieve an element from an array by counting from the end. This one-based index means `^1` returns the last item, `^2` the second-to-last, and so on. The index must be a positive integer greater than zero and can be specified as a literal or an expression that evaluates to an integer.
7575

7676
`array[^index]`
7777

78-
`string[^index]`
78+
If the index exceeds the length of the array, a compilation error occurs for static indices, or a runtime error occurs for dynamic indices.
7979

80-
If the index exceeds the length of the array or string, a compilation error occurs for static indices, or a runtime error occurs for dynamic indices.
81-
82-
For constant arrays or strings, the operator is evaluated at compile time. For dynamic inputs, such as [parameters](./parameters.md), evaluation occurs at deployment time.
80+
For constant arrays, the operator is evaluated at compile time. For dynamic inputs, such as [parameters](./parameters.md), evaluation occurs at deployment time.
8381

8482
### Example
8583

@@ -100,17 +98,6 @@ Output from the example:
10098
| ---- | ---- | ---- |
10199
| secondToLast | string | 'orange' |
102100

103-
```bicep
104-
var text = 'bicep'
105-
output secondToLastChar string = text[^2]
106-
```
107-
108-
Output from the example:
109-
110-
| Name | Type | Value |
111-
| ---- | ---- | ---- |
112-
| secondToLastChar | string | 'p' |
113-
114101
## Function accessor
115102

116103
`resourceName.functionName()`

0 commit comments

Comments
 (0)