Begin Case
* (PACIFIC TRADE GENERAL):
Case Arg1 = '588' Or Arg1 ='570' Or Arg1 ='580' Or Arg1 ='582' Or Arg1 ='583' Or Arg1 ='560' Or Arg1 ='559' Or Arg1 ='549' Or Arg1 ='565' Or Arg1 ='557' Or Arg1 ='552' Or Arg1 ='538' Or Arg1 ='555' Or Arg1 ='579' Or Arg1 ='566' Or Arg1 ='546' Or Arg1 ='574' Or Arg1 ='561' Or Arg1 ='684' Or Arg1 ='553' AND Arg2 >< 'MARSHAL ISL' or Arg2 ><'KWAJALEIN'
Ans = 'PACIFIC TOTAL'
End Case
The problem is that once I added the and clause testing the second variable every test came back positive for Pacific Total.
Why did that and statment screw up the case statment?
Jim
Begin Case
* (PACIFIC TRADE GENERAL):
Case (Arg1 = '588' Or Arg1 ='570' Or Arg1 ='580' Or Arg1 ='582' Or Arg1 ='583' Or Arg1 ='560' Or Arg1 ='559' Or Arg1 ='549' Or Arg1 ='565' Or Arg1 ='557' Or Arg1 ='552' Or Arg1 ='538' Or Arg1 ='555' Or Arg1 ='579' Or Arg1 ='566' Or Arg1 ='546' Or Arg1 ='574' Or Arg1 ='561' Or Arg1 ='684' Or Arg1 ='553') AND (Arg2 >< 'MARSHAL ISL' or Arg2 ><'KWAJALEIN')
Ans = 'PACIFIC TOTAL'
End Case
Peytot wrote:Begin Case
* (PACIFIC TRADE GENERAL):
Case (Arg1 = '588' Or Arg1 ='570' Or Arg1 ='580' Or Arg1 ='582' Or Arg1 ='583' Or Arg1 ='560' Or Arg1 ='559' Or Arg1 ='549' Or Arg1 ='565' Or Arg1 ='557' Or Arg1 ='552' Or Arg1 ='538' Or Arg1 ='555' Or Arg1 ='579' Or Arg1 ='566' Or Arg1 ='546' Or Arg1 ='574' Or Arg1 ='561' Or Arg1 ='684' Or Arg1 ='553') AND (Arg2 >< 'MARSHAL ISL' or Arg2 ><'KWAJALEIN')
Ans = 'PACIFIC TOTAL'
End Case
That can be better ...
Pey
Hmm that gave me a diff respose but now what I needed. It still labled the test case that had both arguments filled in as pacific total even though the second argument = Marshal ISL which should have made the statment not true. Is it because im not giving it something to be if its not true?
Also how do i get the text to wrap around in my window. Right now its all on one long line and i cant realy work with it that way.
Jim
FindValue = Arg1
ListOfValues = Arg2
CONVERT "," TO @AM IN ListOfValues
LOCATE FindValue IN ListOfValues SETTING POSITION Then
Found = @TRUE
End Else
Found = @FALSE
End
Ans = Found
DEFFUN INLIST(FindValue, ListOfValues) Calling "DSU.INLIST"
Begin Case
* (PACIFIC TRADE GENERAL):
Case ( INLIST(Arg1 , '588,570,580,582,583,560,559,549,565,557,552,538,555,579,566,546,574,561,684,553') AND ( Arg2 >< 'MARSHAL ISL' or Arg2 ><'KWAJALEIN' )
Ans = 'PACIFIC TOTAL'
End Case
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Program "DSU.casetest": Line 27, Unable to open the operating system file "DSU_BP.O/DSU.INLIST".
[ENOENT] No such file or directory
Program "DSU.casetest": Line 27, Unable to load file "DSU.INLIST".
Program "DSU.casetest": Line 27, Unable to load subroutine.
Jim, BASIC has no inherent INLIST function, so I wrote one for you. Create a new FUNCTION in DS Manager just as I describe in the top portion of my most recent post. Then, compile it and test it. Enhance it all you like, putting in TRIMs, UPCASES, whatever.
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
You'll notice I put a DEFFUN in the case statement logic. When you want to call another user written function from inside another, you will have to do this declaration at the top of any functions needing to "see" the other function. You're missing this in your casetest function, and I suspect you didn't do the INLIST function first.
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
kcbland wrote:Jim, BASIC has no inherent INLIST function, so I wrote one for you. Create a new FUNCTION in DS Manager just as I describe in the top portion of my most recent post. Then, compile it and test it. Enhance it all you like, putting in TRIMs, UPCASES, whatever.
I have done what you said and I am getting the same result as I got from my code. The statment should be proving false and yet it is treating it like it is true. I dont understand basic right now so I prefer to do it the "Hard Way" because thats all I know and because u have to start at the bottom with anything in life. As it stands both ways are incorrect. It has to do with the way it is handeling the And arg2 >< step. When I test i fill in the arg2 as one of the two in the list that the variable can not be. this test as true though it should not. Any thoughts on that?
Jim
First things first, do you like the INLIST function better? And do you see how you can write FUNCTIONS to make life easier (what I call the Bag of Tricks).
Okay, how about you paste two test cases, one that should prove TRUE and the other FALSE. We can workout your logic from there. I formed your logic into the INLIST function to make life easier and more readable.
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
INLIST(Arg1,'588,570,580,582,583,560,559,549,565,557,552,538,555,579,566,546,574,561,684,553')
AND NOT(INLIST(Arg2,'MARSHAL ISL,KWAJALEIN' ))
Much prettier too? Style points count
Last edited by kcbland on Tue Nov 04, 2003 1:47 pm, edited 1 time in total.
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
kcbland wrote:First things first, do you like the INLIST function better? And do you see how you can write FUNCTIONS to make life easier (what I call the Bag of Tricks).
Okay, how about you paste two test cases, one that should prove TRUE and the other FALSE. We can workout your logic from there. I formed your logic into the INLIST function to make life easier and more readable.
I like the inlist funuction...but I dont understand it. I will not use something that I dont understand in a production job. I just cant do that.
as for the test cases:
arg1 arg2
583 MARSHAL ISL
570 Test
The fist example should not be true because MARSHAL ISL is specificaly stated as to not be equal to for the statment to be true and the second should be true because it is not in the list of places that must be not equal to.
Jim
Your code as written appears to be true to me in both cases you've presented. MARSHALISL is not KWAJALEIN AND 583 is one of the Arg1 choices. Likewise for Test. Test is not MARSHALISL and Test is not KWAJALEIN so they are both true AND 570 is in the Arg1 list so that is true. TRUE AND TRUE = TRUE
Mixing ANDs, ORS and negative logic! Your case statment should not pass your understanding before putting in production comment.
Begin Case
* (PACIFIC TRADE GENERAL):
Case ( Arg1 = '588' Or Arg1 ='570' Or Arg1 ='580' Or Arg1 ='582' Or Arg1 ='583' Or Arg1 ='560' Or Arg1 ='559' Or Arg1 ='549' Or Arg1 ='565' Or Arg1 ='557' Or Arg1 ='552' Or Arg1 ='538' Or Arg1 ='555' Or Arg1 ='579' Or Arg1 ='566' Or Arg1 ='546' Or Arg1 ='574' Or Arg1 ='561' Or Arg1 ='684' Or Arg1 ='553') AND NOT(Arg2 = 'MARSHAL ISL' OR Arg2 = 'KWAJALEIN')
Ans = 'PACIFIC TOTAL'
End Case
Last edited by kcbland on Tue Nov 04, 2003 1:48 pm, edited 1 time in total.
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
trobinson wrote:Arg1 = 583 TRUE
Arg2 is not MARSHAL ISL
OR
Arg2 is not KWAJALEIN
Your code as written appears to be true to me in both cases you've presented. MARSHALISL is not KWAJALEIN AND 583 is one of the Arg1 choices. Likewise for Test. Test is not MARSHALISL and Test is not KWAJALEIN so they are both true AND 570 is in the Arg1 list so that is true. TRUE AND TRUE = TRUE
Mixing ANDs, ORS and negative logic! Your case statment should not pass your understanding before putting in production comment.
Look at the Parentheses the and statement is wrapped in. That makes the statement say or not equal to MARSHALISL or not equal to KWAJALEIN.
The statement as written (at least in all the other languages that I have coded in) would translate into English as...
arg1 equals 5.. or 5.. or 5.. and arg2 not equal to bla bla or not equal to bla bla. I have coded it as simply as I could to keep the logic as clear as I could.
Regards