Skip to content

Commit

Permalink
Update cachematrix.R
Browse files Browse the repository at this point in the history
added message
  • Loading branch information
SimonAM authored Jul 23, 2016
1 parent d1a3bb2 commit ec80167
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cachematrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
##If a matrix is already cached it wont be caclulated again.

##Creates an object which stores 4 functions and an inverted matrix as the result of the cachematrix function.

makeCacheMatrix <- function(x = matrix()) {
m <- NULL
set <- function(y) {
Expand All @@ -23,9 +24,10 @@ cacheSolve <- function(x) {
if(!is.null(m)) {
message("getting cached data")
return(m)
}
} else{message("inverting matrix...")
data <- x$get()
m <- solve(data)
x$setsolve(m)
m
}
}

0 comments on commit ec80167

Please sign in to comment.