xxxxxxxxxx
The dowhile statement creates a loop that executes a specified statement until the test condition evaluates to false. The condition is evaluated after executing the statement, resulting in the specified statement executing at least once.
xxxxxxxxxx
A dowhile loop is similar to a while loop, except that a dowhile loop is guaranteed to execute at least one time.
Syntax :
do {
// Statements
}while(Boolean_expression);
Notice that the Boolean expression appears at the end of the loop, so the statements in the loop execute once before the Boolean is tested.
If the Boolean expression is true, the control jumps back up to do statement, and the statements in the loop execute again. This process repeats until the Boolean expression is false.
xxxxxxxxxx
public class DoWhileLoop : MonoBehaviour
{
void Start()
{ // Difference is that it will run one time before is read
bool shouldContinue = false;
do
{
print ("Hello World");
}while(shouldContinue == true);
}
}
xxxxxxxxxx
FunctionPointerExample objFunctionPointerExample = new FunctionPointerExample();
//Call GetName function using TestDelegate
TestDelegate objDelegate1 = new TestDelegate(objFunctionPointerExample.GetName);
objDelegate1.Invoke("Mukesh Kumar");
xxxxxxxxxx
FunctionPointerExample objFunctionPointerExample = new FunctionPointerExample();
//Call GetName function using TestDelegate
TestDelegate objDelegate1 = new TestDelegate(objFunctionPointerExample.GetName);
objDelegate1.Invoke("Mukesh Kumar");