Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2472359

Browse files
committed
more comments
1 parent ceee71b commit 2472359

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cachematrix.R

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,22 @@
1010
## functions to get and set the matrix and inverse stored within.
1111

1212
makeCacheMatrix <- function(dataMatrix = matrix()) {
13+
# Variable for storing the matrix's inverse
1314
inv = NULL
15+
16+
# Getters and setters for the stored matrix
1417
setFunc = function(newVal) {
1518
dataMatrix <<- newVal
16-
inv <<- NULL
19+
inv <<- NULL # New matrix means old inverse isn't valid anymore
1720
}
1821
getFunc = function() dataMatrix
22+
23+
# Getters and setters for the stored inverse
1924
setInverseFunc = function(inverse) inv <<- inverse
2025
getInverseFunc = function() inv
26+
27+
# Return a list wrapper object giving access to the matrix
28+
# and its inverse
2129
list(set = setFunc, get = getFunc,
2230
setInverse = setInverseFunc, getInverse = getInverseFunc)
2331
}

0 commit comments

Comments
 (0)