Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have loop that send to function that compare data and return true\false (isEqual), and than print the result. and I have boolean variable IsTestpassed that I want him to contain false at the first time that the function return false...
I want the output look:
true (isEqual)
true (isEqual)
false (isEqual)
true (isEqual)
Is the test passed: false(the value of IsTestpassed that changed for the third time performed the function).
In summary:I need that IsTestpassed will depend on isEqual while isEqual true,at the first time it becames false I want that IsTestpassed will stay false.
How can I do it?
Posted
Comments
OriginalGriff 12-Nov-13 6:39am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Use the "Improve question" widget to edit your question and provide better information.
Member 10304617 12-Nov-13 6:44am    
In summary:I need that IsTestpassed will depend on isEqual while isEqual true,at the first time it becames false I want that IsTestpassed will stay false.
How can I do it?

This is not right and clear enough?
agent_kruger 12-Nov-13 7:36am    
please specify clearly we cannot understand what you want to achieve
Member 10304617 12-Nov-13 15:47pm    
I do not know how to explain better...
Thanks anyway!!!

1 solution

I did not understand clearly what is your problem, but you may need a function like:
C#
IsTestPassed &= isEqual;


This way, whenever your isEqual function returns false, this will set IsTestPassed to false.
I.e., the only way for IsTestPassed to be true is that every isEqual call has returned true.

[edit]I forgot to mention that this will only work if you initialize your IsTestPassed variable to true.[/edit]
 
Share this answer
 
v2
Comments
Member 10304617 12-Nov-13 13:11pm    
thanks!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900