Skip to content

Commit cd9155e

Browse files
committed
cover nullable type modifier
1 parent 90e1299 commit cd9155e

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

articles/azure-resource-manager/bicep/data-types.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Data types in Bicep
33
description: This article describes the data types that are available in Bicep.
44
ms.topic: reference
5-
ms.date: 06/30/2025
5+
ms.date: 07/07/2025
66
ms.custom: devx-track-bicep
77
---
88

@@ -437,6 +437,16 @@ The union type has some limitations:
437437

438438
You can use the union type syntax in [user-defined data types](./user-defined-data-types.md).
439439

440+
## Nullable Types
441+
442+
You can make any primitive or complex type nullable by appending a `?` to the type name. This allows the parameter, variable, or output to accept null as a valid value. For example:
443+
444+
```bicep
445+
param description string? = null
446+
param config object? = null
447+
output optionalValue int? = null
448+
```
449+
440450
## Secure strings and objects
441451

442452
Secure strings use the same format as string, and secure objects use the same format as object. With Bicep, you add the `@secure()` [decorator](./parameters.md#use-decorators) to a string or object.

articles/azure-resource-manager/templates/template-functions-array.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ The output from the preceding example with the default values is:
227227

228228
`indexFromEnd(sourceArray, reverseIndex)`
229229

230-
Returns an element of the array by counting backwards from the end. This is useful when you want to reference elements starting from the end of a list, rather than the beginning. The [`tryIndexFromEnd()`](#tryindexfromend) function is a safe version of `indexFromEnd()`.
230+
Returns an element of the array by counting backwards from the end. This is useful when you want to reference elements starting from the end of a list, rather than the beginning. The [`tryIndexFromEnd`](#tryindexfromend) function is a safe version of `indexFromEnd`.
231231

232232
In Bicep, use the [Reserved index accessor](../bicep/operators-access.md#reverse-index-accessor) operator.
233233

@@ -244,7 +244,7 @@ A single element from an array, selected by counting backward from the end of th
244244

245245
### Example
246246

247-
The following example shows how to use the first function with an array and string.
247+
The following example shows how to use the `indexFromEnd` function.
248248

249249
```json
250250
{
@@ -748,7 +748,7 @@ The output from the preceding example with the default values is:
748748

749749
`tryndexFromEnd(sourceArray, reverseIndex)`
750750

751-
The `tryIndexFromEnd()` function is a safe version of [`indexFromEnd()`](#indexFromEnd). It retrieves a value from an array by counting backward from the end without throwing an error if the index is out of range.
751+
The `tryIndexFromEnd` function is a safe version of [`indexFromEnd`](#indexfromend). It retrieves a value from an array by counting backward from the end without throwing an error if the index is out of range.
752752

753753
In Bicep, use the [Reserved index accessor](../bicep/operators-access.md#reverse-index-accessor) operator and the [Safe dereference](../bicep/operator-safe-dereference.md#safe-dereference) operator.
754754

@@ -815,7 +815,7 @@ The following example shows an out-of-bound scenario:
815815
},
816816
"resources": {},
817817
"outputs": {
818-
"secondToLast": {
818+
"outOfBound": {
819819
"type": "string",
820820
"nullable": true,
821821
"value": "[tryIndexFromEnd(parameters('items'), 5)]"
@@ -828,7 +828,7 @@ The output from the preceding example with the default values is:
828828

829829
| Name | Type | Value |
830830
| ---- | ---- | ----- |
831-
| secondToLast | String | (null) |
831+
| outOfBound | String | (null) |
832832

833833
## union
834834

articles/azure-resource-manager/templates/toc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ items:
469469
- name: All functions
470470
href: template-functions.md
471471
- name: Array functions
472-
displayName: array,concat,contains,createArray,empty,first,indexOf,intersection,last,lastIndexOf,length,max,min,range,skip,take,union
472+
displayName: array,concat,contains,createArray,empty,first,indexFromEnd,indexOf,intersection,last,lastIndexOf,length,max,min,range,skip,take,tryIndexFromEdn,union
473473
href: template-functions-array.md
474474
- name: CIDR functions
475475
displayName: parseCidr,cidrSubnet,cidrHost

0 commit comments

Comments
 (0)