MetaCase Homepage
Forum Home Forum Home > > MetaEdit+
  New Posts New Posts RSS Feed - Omitting the last 'AND'
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Omitting the last 'AND'

 Post Reply Post Reply
Author
Message
mert View Drop Down
Contributor
Contributor


Joined: 16.Mar.2016
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote mert Quote  Post ReplyReply Direct Link To This Post Topic: Omitting the last 'AND'
    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
}
Back to Top
jpt View Drop Down
MetaCase
MetaCase
Avatar

Joined: 25.Mar.2008
Points: 239
Post Options Post Options   Thanks (1) Thanks(1)   Quote jpt Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.05
Copyright ©2001-2022 Web Wiz Ltd.

This page was generated in 0.031 seconds.