![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Switch or "Select case" statement Topic Summary: Created On: 7-Jul-2008 13:59 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Dear Friends,
I would like to know if exist any statement in DXL like Switch or Select Case. I've already looked at the documentation and haven't find it. Thank you. |
|
![]() |
|
![]() |
|
Thiago, DOORS DXL has no such critter, yet.
However, you can make a substitue that may meet your needs, as follows: Edited: 7-Jul-2008 at 16:11 by ron lewis |
|
![]() |
|
![]() |
|
If you run this "dxl" code
int n = 0 switch(n) { case 1: ack "1" break } you get the following error messages: -E- DXL: <Line:4> incorrect arguments for 'case' statement -E- DXL: <Line:2> incorrect arguments for 'switch' statement -E- DXL: <Line:7> switch not yet supported -I- DXL: all done with 3 errors and 0 warnings in DOORS 8.3 ------------------------- Pekka.Makinen@softqa.fi SoftQA Oy -http://www.softqa.fi/ |
|
![]() |
|
![]() |
|
In lieu of a case statement, I have used something like the following:
void doCaseStatement(string myTest) { bool done = false while(!done) { if(myTest=="Case 1") {doFunction1;break} if(myTest=="Case 2") {doFunction2;break} if(myTest=="Case 3") {doFunction3;break} if(myTest=="Case 4") {doFunction4;break} if(myTest=="Case 5") {doFunction5;break} if(myTest=="Case 6") {doFunction6;break} if(myTest=="Case 7") {doFunction7;break} if(myTest=="Case 8") {doFunction8;break} doDefaultFunction done=true } } The "break" will break out of the while loop. The "done" flag will ensure the while loop is executed only once. This probably isn't any better than a bunch of if/elseif statements, but it is another method. The following is pretty much equivalent: void doCaseStatement(string myTest) { if(myTest=="Case 1") {doFunction1} elseif(myTest=="Case 2") {doFunction2} elseif(myTest=="Case 3") {doFunction3} elseif(myTest=="Case 4") {doFunction4} elseif(myTest=="Case 5") {doFunction5} elseif(myTest=="Case 6") {doFunction6} elseif(myTest=="Case 7") {doFunction7} elseif(myTest=="Case 8") {doFunction8} else {doDefaultFunction} } Edited: 8-Jul-2008 at 20:06 by David Jakad |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Switch or "Select case" statement
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.