What happens when you don't nameProcessGuess()'s FString parameter?

Firstly I want to confirm if I’m correctly understanding how the parameters and arguments work.

When the code compiles and sees ‘Input’ passed through as an argument for the ProcessGuess() function, because it’s a string it then redefines it as ‘Guess’ within the scope of the ProcessGuess() function?

If that is the case, if you don’t redefine the FString ‘Guess’ at all, and leave it like this:
parameter snip

How would you refer to ‘Input’ in the function? Would you just type ‘Input’ instead?

Secondly, in the header file, ‘Input’ is included as a parameter for the ‘OnInput()’ function ,
parametrs
so why doesn’t it work when it’s used as a parameter for ‘ProcessGuess()’?

It’s essentially doing FString Guess = Input when you call the function.

You can’t

It’s not used at all in the declaration. You don’t even have to name parameters in a declaration. However It comes up in tooltips so it’s preferable if you give it a name so users can see what should be entered there. Seeing a list of types isn’t going to help anyone e.g.

void DrawDebugLine(const UWorld*, FVector const& , FVector const&, FColor const&, bool, float, uint8, float);

Seeing that come up in autocomplete is not helpful.
vs what Unreal actually has

void DrawDebugLine(const UWorld* InWorld, FVector const& LineStart, FVector const& LineEnd, FColor const& Color, bool bPersistentLines = false, float LifeTime = -1.f, uint8 DepthPriority = 0, float Thickness = 0.f);

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

Privacy & Terms