Skip to content

Commit f2342ca

Browse files
KalimdorKalimdor
Kalimdor
authored and
Kalimdor
committed
2nd programming assignment
1 parent 8d32353 commit f2342ca

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

cachematrix.R

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
## Makes a matrix object able to store a cache of its inverse
44
makeCacheMatrix <- function(x = matrix()) {
5-
m <- NULL
5+
i <- NULL
66
set <- function(y) {
77
x <<- y
8-
m <<- NULL
8+
i <<- NULL
99
}
1010
get <- function() x
11-
setinverse <- function(inverse) m <<- inverse
12-
getinverse <- function() m
11+
setinverse <- function(inverse) i <<- inverse
12+
getinverse <- function() i
1313
list(set = set, get = get,
1414
setinverse = setinverse,
1515
getinverse = getinverse)
@@ -19,14 +19,14 @@ makeCacheMatrix <- function(x = matrix()) {
1919
## It returns the cached version if it was already computed.
2020
cacheSolve <- function(x, ...) {
2121
## Return a matrix that is the inverse of 'x'
22-
m <- x$getinverse()
23-
if(!is.null(m)) {
22+
i <- x$getinverse()
23+
if(!is.null(i)) {
2424
message("getting cached data")
25-
return(m)
25+
return(i)
2626
}
2727
data <- x$get()
28-
m <- solve(data)
29-
x$setinverse(m)
30-
m
28+
i <- solve(data)
29+
x$setinverse(i)
30+
i
3131
}
3232

0 commit comments

Comments
 (0)