Print Page | Close Window

Omitting the last 'AND'

Printed From: MetaCase
Category:
Forum Name: MetaEdit+
Forum Description: All topics relating to MetaEdit+ or DSM
URL: http://www.metacase.com/forums/forum_posts.asp?TID=921
Printed Date: 07.Aug.2020 at 16:52
Software Version: Web Wiz Forums 10.16 - http://www.webwizforums.com


Topic: Omitting the last 'AND'
Posted By: mert
Subject: Omitting the last 'AND'
Date 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
}



Replies:
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 - http://www.webwizforums.com
Copyright ©2001-2013 Web Wiz Ltd. - http://www.webwiz.co.uk