Print Page | Close Window

Omitting the last 'AND'

Printed From: MetaCase
Forum Name: MetaEdit+
Forum Description: All topics relating to MetaEdit+ or DSM
Printed Date: 28.Jul.2021 at 02:17
Software Version: Web Wiz Forums 10.16 -

Topic: Omitting the last 'AND'
Posted By: mert
Subject: Omitting the last 'AND'
Date Posted: 15.Apr.2020 at 09:52

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.


do ~To>()~From.(){
if  type <> '.......' then
if type <> '.........' then
:Name ' AND '
else '....... ' :Name ' ' newline '..... '

Posted By: jpt
Date Posted: 16.Apr.2020 at 13:07
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.

Print Page | Close Window

Forum Software by Web Wiz Forums® version 10.16 -
Copyright ©2001-2013 Web Wiz Ltd. -