Mohammad,
Comparing two values for which is the greater - 5.1.20 ONLY because it uses
match and min operators
<$set name=input1 value=3>
<$set name=input2 value=5>
<$list filter="=[<input1>!match<input2>]" emptyMessage="equals">
<$list filter="=[<input1>min<input2>match<input1>]">
Input 1 = Minimum
</$list>
<$list filter="=[<input1>max<input2>match<input1>]">
Input 1 = Maximum
</$list>
</$list>
</$set></$set>
Tony
On Saturday, August 3, 2019 at 8:52:03 PM UTC+10, Mohammad wrote:
>
> Tony,
> One question, how do you propose to implement the below construct using
> $list widget
>
> if a>b then
> do this part one
> else if a<b
> do this part two
> end
>
>
>
>
> or only
>
> if a< b then
> do this true part
> end
>
>
>
> Now using match we can implement if a=b.
>
> --Mohammad
>
>
> On Thursday, August 1, 2019 at 3:46:23 AM UTC+4:30, TonyM wrote:
>>
>> Your welcome
>>
>> So on 5.1.20
>> <$list filter="[<casevariable>] ~[[false]]" variable=case>
>> <$list filter="[<case>match[false]]" variable=case>
>> Do this if no case value
>> </$list>
>> <$list filter="[<case>match[caseone]]" variable=case>
>> Process "caseone"<br>
>> </$list>
>> <$list filter="[<case>match[casetwo]]" variable=case>
>> Process "casetwo"<br>
>> </$list>
>> <$list filter="[<case>match[casethree]]" variable=case>
>> Process "casethree"<br>
>>
>> </$list>
>> <!-- Even this -->
>> <$list filter="[<case>match[casetwo]] [<case>match[casethree]]"
>> variable=case>
>> Process "casetwo" and "casethree"<br>
>> </$list>
>> </$list>
>>
>> Regards
>> Tony
>>
>> On Thursday, August 1, 2019 at 3:34:59 AM UTC+10, Mohammad wrote:
>>>
>>> Thanks Tony!
>>> This is great for code readability!
>>>
>>> Cheers
>>> Mohammad
>>>
>>> On Wednesday, July 31, 2019 at 5:46:25 PM UTC+4:30, TonyM wrote:
>>>>
>>>> Folks,
>>>>
>>>> Ad a result of Jeremy adding a new match operator to 5.1.20 the case
>>>> statements in this code pattern will be even more user friendly.
>>>>
>>>> First we would say
>>>>
>>>> [<case>prefix[caseone]suffix[caseone]]
>>>>
>>>> Now we would say
>>>> [<case>regexp[^caseone$]]
>>>>
>>>> But this Will become which is easier to remember
>>>> [<case>match[caseone]]
>>>>
>>>> The regex example still points us to the best approach for more complex
>>>> tests but match will work for many common cases.
>>>>
>>>> I will now abandon only testing the negative in binary comparisons such
>>>> as
>>>> [<var>] -[[false]]
>>>>
>>>> becomes
>>>> [<var>match[true]]
>>>>
>>>> the case insensitive option may also help when var or
>>>> [{$:/temp/tiddler}] was provided by the user in case they entered tRue and
>>>> other combinations by mistake.
>>>>
>>>> Thanks Jeremy
>>>> Tony
>>>>
>>>>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/05812caa-0364-4d91-9734-bd0a8a486de5%40googlegroups.com.