Interesting trick with comments in Visual Basic

Hi all.

A neat trick for those of you using Visual Studio 2017. I don’t know if this will work in 2015, but maybe someone on that version can chime in and let us know.

In any case, I found another reason to put comments to all your functions before you define them. Doing so will add what you enter in your comment as part of the tooltip when you mouse over your function name. It doesn’t work if your comment is inside the definition. It has to be the line before your function.

You’ll find that feature in many of the programming languages out there. It definitely works in VS 2015. In Unreal, those comments will also pop up as tool tips on functions and properties in the editor. It’s all fits into the puzzle of making your code as “self documenting” as possible.
As a rule, I like to code and comment in such a way that if I walk away from the code for a year, I dive back into the code and know exactly what’s going on.

1 Like

…and then I notice that Ben actually showed it in Lecture 35. Guess I jumped the gun on that one. :smiley:

I’d like to encourage you to keep finding features and tricks ahead of Ben and Sam’s lectures! (The fact is, Ben’s lectures are a starting point, to get you thinking in the right direction, the real learning will come when you say “but what if I tried this instead?”

Privacy & Terms