-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmapArray.bicep
32 lines (31 loc) · 860 Bytes
/
mapArray.bicep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
var varGroceryStore = [
{
productName: 'Icecream'
productPrice: 5
productCharacteristics: [
'Vegan'
'Seasonal'
]
}
{
productName: 'Cheese'
productPrice: 2
productCharacteristics: [
'Bio'
]
}
{
productName: 'Banana'
productPrice: 4
productCharacteristics: [
'Bio'
]
}
]
output outUsingMap array = map(varGroceryStore, item => item.productName)
output outUsingMapAndStringInterpolation array = map(varGroceryStore, item => 'The price of item ${item.productName} is ${item.productPrice}.')
output outputDiscount array = map(range(0, length(varGroceryStore)), item => {
productNumber: item
productName: varGroceryStore[item].productName
discountedPrice: 'The item ${varGroceryStore[item].productName} is on sale. Sale price: ${(varGroceryStore[item].productPrice / 2)}'
})