Skip to content

Commit 8088fda

Browse files
committed
add comments to makeCacheMatrix function
1 parent 76da95f commit 8088fda

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

cachematrix.R

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,24 @@
55
## that can cache its inverse.
66

77
makeCacheMatrix <- function(x = matrix()) {
8+
## Store inverse of x as part of object
89
inverse_x <- NULL
10+
11+
## setter function for setting intital matrix
912
set <- function(y) {
1013
x <<- y
14+
## New matrix means inverse must be recalculated
1115
inverse_x <<- NULL
1216
}
17+
## getter function for getting intial matrix
1318
get <- function() x
19+
20+
## setter function for getting matrix inverse
1421
setinverse <- function(inverse) inverse_x <<- inverse
22+
23+
## getter function for getting matrix inverse
1524
getinverse <- function() inverse_x
25+
1626
list(set = set, get = get,
1727
setinverse = setinverse,
1828
getinverse = getinverse)

0 commit comments

Comments
 (0)