Why do some codes requires ; at the back while some dont?

why do some codes requires ; at the back while some dont?

Examples?

Hi For example,

void UBullCowCartridge::BeginPlay()

{

Super::BeginPlay();

is it because functions do not require the use of semicolon, however within the functions as we pass our code , we would then require a semi colon ?

Hello! To be more specific about terminology, semicolons are used to end a statement. So, in the code you pasted, the first line is the start of a function definition stating exactly what this function, void UBullCowCartridge::BeginPlay() will do if something calls it. A function definition isn’t a statement but rather a code block which can contain statements, which is why it begins and ends with curly braces instead of a semicolon. The third line is a function call, which is a statement saying to call Super::BeginPlay().

I hope that helped :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms