Log in

View Full Version : help with c++ code


awad1992
08-03-2009, 08:58
hello!
im from team 1946 in israel i just want to ask if we can do more than one (else if) in the same code

in other words , is it correct ?

if(!limitswitch1->Get())
jaguar1->Set(0.0);
Wait(0.05);
jaguar1->Set(0.5);
Wait(0.5);
jaguar1->Set(0.0);
else if (!limitswitch2->Get())
jaguar1->Set(0.0);
Wait(0.05);
jaguar1->Set(-0.5);
Wait(0.5);
jaguar1->Set(0.0);
else if (!limitswitch3 & leftStick->GetRawButton(10)
jaguar1->Set(0.0);
else jaguar1->Set(leftStick->GetZ() );

thanks

byteit101
08-03-2009, 12:39
if(!limitswitch1->Get())
{
jaguar1->Set(0.0);
Wait(0.05);
jaguar1->Set(0.5);
Wait(0.5);
jaguar1->Set(0.0);
}
else if (!limitswitch2->Get())
{
jaguar1->Set(0.0);
Wait(0.05);
jaguar1->Set(-0.5);
Wait(0.5);
jaguar1->Set(0.0);
}
else if (!limitswitch3 & leftStick->GetRawButton(10))
{
jaguar1->Set(0.0);
}
else
{
jaguar1->Set(leftStick->GetZ() );
}
yes, as long as you have {}

awad1992
08-03-2009, 13:18
thank you very much