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: 148

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

About

Latest Activity

Irina Shamaeva posted an event

Overcoming AI Bias in Sourcing at virtual

May 22, 2024 from 8am to 9am
Monday
Chris Martel is attending Theresa Cromie's event
Thumbnail

Seven Day Sourcing Bootcamp with Irina Shamaeva and David Galley at Online

June 4, 2024 at 8am to June 13, 2024 at 9am
May 6
Irina Shamaeva and Jose Merciline are now friends
May 2
Alexa British is now a member of Boolean Strings Network
Apr 30

© 2024   Created by Irina Shamaeva.   Powered by

Badges  |  Report an Issue  |  Terms of Service