#How can i name my functions better?

1 messages · Page 1 of 1 (latest)

hushed rootBOT
#

<@&987246399047479336> please have a look, thanks.

hushed rootBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

remote mason
#

When naming functions, it's important to choose names that are descriptive and accurately reflect what the function does. Here are a few tips for naming functions:

Use meaningful and specific names: The name of the function should clearly indicate what the function does. For example, a function that calculates the area of a circle should be named "calculateCircleArea" rather than just "area".

Use verbs: The name of the function should usually be a verb that describes the action that the function performs. For example, "getLocation" or "calculateArea"

Use camelCase: camelCase is a naming convention where the first letter of each word in the name is capitalized except the first word. This makes the function names easy to read and understand.

Avoid abbreviations: Avoid using abbreviations in function names as they can make the code harder to understand.

Be consistent: Consistency is key in naming functions and it makes the code more readable and maintainable. Try to use similar naming conventions throughout your code.

By following these tips, you can make your function names more descriptive, easy to understand, and consistent with the rest of your code.

wraith flume
#

#educational_media_old message

#

Really good suggestions from Lee, apart from that i remember watching this vid a while ago but i think most of the stuff is similar

narrow moth
#

In a time and world where we have autocomplete, I see no reason to not have long names, that counts for variables as well. call them something that indicates their function. that is my advice. I only ever use single letter variable names in examples or in loop counters.