Hi,
I am working on some code that “gets” the first item in an Each
loop and prints a special UI for it, using <Each Items="{downloadItems}"><Match Items="{index}"><Case Number="0"> ... </Case></Match></Each>
.
However for all the other items in the Each loop I would like to print a different UI. How can I “else” this Match/Case block?
Something equivalent to the code below, but in UX?:
if (index == 1)
{
printSpecialUI();
}
else
{
printRegularUI();
}
Match/Case would be like the switch statement so:
<Each>
<Match Value="{index}">
<Case Number="0">
// special ui
</Case>
<Case Number="1">
// special ui
</Case>
</Match>
</Each>
Edwin Reynoso wrote:
Match/Case would be like the switch statement so:
Actually I just figured it out. You can use any other value and set it as the default, so if no other matches are found it will fall in that case.
<Case Number="0"> ... </Case>
<Case Number="100" IsDefault="true"> ... </Case>
Thanks!
Interesting I see its just like switch statements then where you have default:
:
switch(someVal) {
case 1:
doSomething();
case 2:
doSomethingElse();
default:
doDefault();
}