This is a stripped-down version of a single section of Grok TiddlyWiki, optimized for fast loading and readability by search engines. Some features are missing.

For the full Grok TiddlyWiki experience, please visit the wiki version of this page.

Ex:ConditionalProcedure

 28th September 2024 at 7:26pm

This code snippet is quite repetitive:

<ul>
  <% if [all[current]has[email]] %>
    <li>''Email'': {{!!email}}</li>
  <% endif %>
  <% if [all[current]has[phone]] %>
    <li>''Phone'': {{!!phone}}</li>
  <% endif %>
  <% if [all[current]has[family]] %>
    <li>''Family'': {{!!family}}</li>
  <% endif %>
  <% if [all[current]has[manager]] %>
    <li>''Manager'': {{!!manager}}</li>
  <% endif %>
</ul>

Write a procedure that wraps the logic that's repeated here, and call it four times to produce the same result.

Hint: To transclude a field of the current tiddler whose name is in a variable, use the $transclude widget with the $field parameter: <$transclude $field=<<myvariable>>/>.

Go to answer: Ex:ConditionalProcedure/answer