Skip to content

Commit a2613c7

Browse files
committed
Added some comments
1 parent 87cc91a commit a2613c7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cachematrix.R

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33

44
## Write a short comment describing this function
55

6+
## Creates an opbect of type list that acts as a storage device.
7+
## Stores the original matrix value and what will be the solve which is set to null
8+
## This is essentially a getter setter to put it into OOP terms I am familier with
69
makeCacheMatrix <- function(x = matrix()) {
7-
s <- NULL
10+
s <- NULL #set s = null
811
set <- function(y) {
912
x <<- y
1013
s <<- NULL
@@ -19,7 +22,10 @@ makeCacheMatrix <- function(x = matrix()) {
1922

2023

2124
## Write a short comment describing this function
22-
25+
## Accesses the makeCacheMatrix object (not the function).
26+
## Gets the value of the matrix used to create the object.
27+
## If solve has not been calculated then it calculates and stores it
28+
## If it has been calculated it gets and returns the value
2329
cacheSolve <- function(x, ...) {
2430
## Return a matrix that is the inverse of 'x'
2531
s <- x$getsolve()

0 commit comments

Comments
 (0)