Boolean Strings Network

The Internet Sourcing Community

What should hopefully be a really simple question - TestComplete C# syntax boolean...

Hi

I cant seem to find this syntax in the help files for test complete and have tired things like not, (!) etc and not chanced on it yet.

I would like to be able to change the value of a boolean variable to the opposite of its current value.

ie if it is true set it to false
if false set to true
in one line without having to use if statements

I am using C# as the test complete scripting language and I am not a developer and learning as I go so please if anyone can answer this - keep it simple ;) (or just stick an example of the syntax) I know what I want to do in terms of the logic i just cant find out what the correct syntax is.

thanks! - example of what Im trying to achieve below....
ie:
function doStuff(boolean)

//for the sake of this example lets assume my boolean is set at 'true' when this function starts

{
var howManyTimesAmIGonnaDoThis = 10;
var howManyTimesHaveIDoneThisSoFar = 1;

while(howManyTimesHaveIDoneThisSoFar
{
If(boolean==true)
{
dotrueStuff();
}

If(boolean==false)
{
dofalseStuff();
}
(howManyTimesHaveIDoneThisSoFar++);

//set value of boolean to opposite of current value
boolean(THIS IS THE CODE I NEED) //
}
doSomeFinisheyOffeyStuffAfterBeenDoingStuff'howManyTimesAmIGonnaDoThis' times...();
}

And when I ran this function it would do:
true stuff
false stuff
true stuff
false stuff until the counter reached its max....

Views: 154

Reply to This

Replies to This Discussion

And you're asking a recruiter? Have you tried posting this at devbistro or something more akin to a programmer's haven?
Operator ! will do the trick.

a = !b

Irina (recruiter, ex-software engineer)
I thought this was some kind of techie forum? I came here via a google search and the page I landed on had someone asking about a qyuestion about code.... sorry my mistake

Reply to Discussion

RSS

© 2024   Created by Irina Shamaeva.   Powered by

Badges  |  Report an Issue  |  Terms of Service