ubsuny / 23-Homework1G3

Homework 1 Repository Group 3
0 stars 7 forks source link

Documentation/docstrings #21

Closed reshnashrestha closed 12 months ago

reshnashrestha commented 12 months ago

I was curious about docstring and found this : Docstrings, short for "documentation strings," are a specific type of string literal used in computer programming, particularly in languages like Python. They serve the purpose of providing documentation and information about modules, classes, functions, or methods within your code. Docstrings are typically enclosed in triple-quotes (either single or double) and are placed at the beginning of a module, class, function, or method definition. Source: Chatgpt

JustinJaniszewski commented 12 months ago

Here is an example of docstrings from Bard:

def my_function(x, y):
  """This function adds two numbers together.

  Args:
    x: The first number.
    y: The second number.

  Returns:
    The sum of x and y.
  """

  return x + y
reshnashrestha commented 12 months ago

Its a nice example of use of docstring in documentation. Thanks @JustinJaniszewski