Skip to content

Commit ff93c1b

Browse files
committed
Submitting solution2
1 parent 81c53e1 commit ff93c1b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cachematrix.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
makeCacheMatrix <- function(x = matrix()) {
22
#This function creates a special "matrix" object that can cache its inverse.
3-
inverse<-NULL
3+
inverse<-NULL
44
set <- function(y){
55
x<<-y
6-
inverse<<-NULL
6+
inverse<<-NULL
7+
#this means if we change the matrix, we won't retain the old, now incorrect inverse
78
}
89
get <- function() x
910
setinverse <- function(inv) inverse<<-inv
1011
getinverse <- function() inverse
11-
list(set=set, get=get, setinverse=setinverse, getinverse=getinverse)
12+
#return list of functions
13+
list(set=set, get=get, setinverse=setinverse, getinverse=getinverse)
1214
}
1315

1416

0 commit comments

Comments
 (0)