Skip to content

Commit 7e6c3cf

Browse files
author
Brandon Kindred
committed
made code more readable
1 parent a8ba56a commit 7e6c3cf

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

cachematrix.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ makeCacheMatrix <- function(x = matrix()) {
1010
m <<- NULL
1111
}
1212
get <- function() x
13-
setsolve <- function(solve) m <<- solve
14-
getsolve <- function() m
13+
setInverse <- function(inverse) m <<- inverse
14+
getInverse <- function() m
1515
list(set = set, get = get,
16-
setsolve = setsolve,
17-
getsolve = getsolve)
16+
setinverse = setinverse,
17+
getinverse = getinverse)
1818
}
1919

2020

21-
## Write a short comment describing this function
21+
## Cache the Solution
2222

2323
cacheSolve <- function(x, ...) {
2424
## Return a matrix that is the inverse of 'x'
25-
m <- x$getsolve()
25+
inverse <- x$getinverse()
2626
if(!is.null(m)) {
2727
message("getting cached data")
2828
return(m)
2929
}
3030
data <- x$get()
31-
m <- solve(data, ...)
32-
x$setsolve(m)
31+
inverse <- solve(data, ...)
32+
x$setsolve(inverse)
3333
m
3434
}

0 commit comments

Comments
 (0)