In Javascript, C, C++ we have a programming construct called Switch-Case

See : JS: https://www.w3schools.com/js/js_switch.asp, 

switch(*expression*) {
  case *x*:

*    // code block*    break;
  case *y*:

*    // code block*    break;
  default:
    // *code block*
}


This code can do equivalent operation! Is this according to TW good 
programming practice?
Is there any better solution? I think looking in list items may be another 
solution! Does anybody has tried such solution before? 


\define items() One Two [[Three Four]] Five

\define switch(item)
<$list filter="[enlist<items>search<__item__>]" emptyMessage="Zero">
<<currentTiddler>>
</$list>
\end

<<switch One>>
<<switch "Three Four">>
<<switch "Ten">>


This line

<$list filter="[enlist<items>search<__item__>]" emptyMessage="Zero">

Can be like this also

<$list filter="[enlist<items>title<__item__>]" emptyMessage="Zero">


What do you think?

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/b5fb6465-db3a-4809-a878-5b475f3c1b99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to