What exactly is the difference between {?}
and {#}
?
--
After a little test, listing all truthy/falsy values for {?}
, and comparing them to {#}
:
context:
{
values: [
// false
'',
"",
false,
null,
undefined,
[],
// true
0,
"0",
"null",
"undefined",
"false",
{},
{a: 'a'}
]
}
template:
{#values}
{?.}true{:else}false{/.}
{/values}
{~n}
{#values}
{#.}true{:else}false{/.}
{/values}
it outputs EXACTLY the same result:
falsefalsefalsefalsefalsefalsetruetruetruetruetruetruetrue
falsefalsefalsefalsefalsefalsetruetruetruetruetruetruetrue
--
Is really there any difference between them ?
?
and#
evaluate truthiness the same way... If I sum up,#
changes the context and is "array-aware" whereas?
just evaluates truthiness (the same way as#
does). In other words,?
is kinda subset of#
, right? – Kuth