Functions have names and possibly parameters. Parameters are variables that are given the function if it usually couldn't access them within their body.
When functions are called, their bodies get executed. They can return a result or not. If a result should be returned, the keyword
is used. By prepending the keyword
Examples
Gets the return value from "getFavNumber()" and stores it to the number variable
When functions are called, their bodies get executed. They can return a result or not. If a result should be returned, the keyword
- Code:
return
is used. By prepending the keyword
- Code:
thread
Examples
- Code:
disableThirdPersonMode()
{
setDvar("cg_thirdPerson", 0);
}
- Code:
setFieldOfView(angle)
{
setDvar("cg_fov", angle);
}
- Code:
getFavNumber()
{
return 1337;
}
- Code:
disableThirdPersonMode();
- Code:
setFieldOfView(90);
- Code:
thread setFieldOfView(90);
- Code:
int number = getFavNumber();
Gets the return value from "getFavNumber()" and stores it to the number variable