Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » nested if statements with else (nested if statements with else )
nested if statements with else [message #1751919] Mon, 16 January 2017 19:15 Go to next message
taghreed altamimi is currently offline taghreed altamimiFriend
Messages: 184
Registered: October 2014
Senior Member
Hi,
I need to add else part to one of the if statements that i have as below:

if (vdifferences.isDefined()){

for (d in vdifferences){
"vdifferences type ".print()+d.`a_xsi:type`.println();
var vdifferencesReference= d.children.select(a|a.tagName="reference");
for (c in vdifferencesReference){" reference ".print()+c.a_href.println();}
var vdifferencesVlaue= d.children.select(a|a.tagName="value");
for (v in vdifferencesVlaue){
"value= ".print()+v.a_href.split("#").second().println();
var valueId=v.a_href.split("#").second();
"valueName ".print()+getName(valueId).println();}



var vMleft= m.children.selectOne(a|a.tagName="left");
var vMright= m.children.selectOne(a|a.tagName="right");
if(vMleft.isDefined()){ "MleftId=".print()+vMleft.a_href.split("#").second().println();
var vMleftId =vMleft.a_href.split("#").second();
"vMleftName ".print()+getName(vMleftId).println(); }

I need to add else to the following if but when i added it seems that the compiler didn't see this else part at all
if(vMright.isDefined()) {"vMrightId=".print()+vMright.a_href.split("#").second().println();
var vMrightId =vMright.a_href.split("#").second();
"vMrightName ".print()+getName(vMrightId).println();
var vElementname=getName(vMrightId);
"Rule Name ".print()+getRule(vElementname).println();
}else "TTTTT".print()+getType(vMleftId).println();

Can you please help me?
Thanks
Taghreed

[Updated on: Mon, 16 January 2017 19:17]

Report message to a moderator

Re: nested if statements with else [message #1751925 is a reply to message #1751919] Mon, 16 January 2017 20:15 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Taghreed,

I'm not sure I understand what you mean by "didn't see this else part". In my setup the code parses without syntax errors but unfortunately I cannot run it as it appears to be a fragment of a larger program. As explained in [1] it would be really appreciated if you could try to share minimal and self-contained code to help us help you.

Cheers,
Dimitris

[1] https://www.eclipse.org/epsilon/doc/articles/minimal-examples/
Re: nested if statements with else [message #1751979 is a reply to message #1751925] Tue, 17 January 2017 13:37 Go to previous messageGo to next message
Eclipse UserFriend
Please check the result of isDefined(). Sometimes you expect to do a null comparison, but an empty string is also a defined value.
Re: nested if statements with else [message #1751998 is a reply to message #1751979] Tue, 17 January 2017 15:34 Go to previous message
taghreed altamimi is currently offline taghreed altamimiFriend
Messages: 184
Registered: October 2014
Senior Member
Ok Thanks
Previous Topic:Several different input models in EGX
Next Topic:Append documentation for Template object missing in table 7.2 of Epsilon book
Goto Forum:
  


Current Time: Fri Mar 29 01:56:30 GMT 2024

Powered by FUDForum. Page generated in 0.02775 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top