Omitting the last 'AND' |
Post Reply |
Author | |
mert
Contributor Joined: 16.Mar.2016 Points: 15 |
Post Options
Thanks(0)
Posted: 15.Apr.2020 at 09:52 |
Hello, Below is the part of the recursive algorithm I have written in MERL. The algorithm actually goes through an activity diagram from end (to) to start (from) and output some texts for each path. However, I do not want to concatenate the 'AND' text for the last iteration. How can I omit concatenating 'AND' for the last iteration only ? Otherwise, I end up with such a text as "AAA AND BBB AND CCC AND" while I want the text to be "AAA AND BBB AND CCC". I would be grateful if you help me on this regard. RecursiveFunction() do ~To>()~From.(){ if type <> '.......' then RecursiveFunction() if type <> '.........' then :Name ' AND ' endif else '....... ' :Name ' ' newline '..... ' endif }
|
|
jpt
MetaCase Joined: 25.Mar.2008 Points: 239 |
Post Options
Thanks(1)
|
One solution is to apply a variable for the 'AND' and outputting it before the name. In the beginning the variable is empty and then set to respective string value (like 'AND' in the above case) after the name of the element is reported. The 'demo' repository includes examples of this in variety of situations. See e.g. '_WatchesToGenerate()' in the watch example using the variable called @sep.
|
|
Post Reply | |
Tweet |
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |