0% found this document useful (0 votes)
7 views

Documentation Examples

Uploaded by

waghray101177
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Documentation Examples

Uploaded by

waghray101177
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Code Documentation:

Say I have an example class TestClass with three functions a(), b(), c() and a class SecondClass with
two functions e() and f(). should be laid out in the following way:

TestClass.a():
description goes here

TestClass.b():
description goes here

TestClass.c():
description goes here

SecondClass.e():
description goes here

SecondClass.f():
description goes here

This is done for all classes you define. Only your Kotlin code should be discussed. The XML
should be left out.

For the purposes of code documentation lets assume I have a function sum() that looks like this

fun sum(nums: Array<float>) : float {


var total = 0.0
for(int i = 0; i < nums.size(); i++)
total += size
return total
}

an example of good documentation for this would be

TestClass.sum(nums):
Takes in an array of floating point numbers and iterates through them to produce the overall
sum of those numbers which is return to the user

an example of bad documentation would be

TestClass.sum(nums):
initialises a variable total to zero then does a for loop from i to nums.size(). In the loop we
add size to total before returning total after the loop

You might also like