Skip to content

Commit 9a6bab8

Browse files
committed
better indentation
1 parent ae5eefe commit 9a6bab8

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

cachematrix.R

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,23 @@ makeCacheMatrix <- function(x = matrix()) {
3232
## Given an object returned by makeCacheMatrix, calculate the inverse and cache it for further calls.
3333
## If a cached inverse has already been calculated on the wrapped matrix, the cached version is returned.
3434
cacheSolve <- function(x, ...) {
35-
## Return a matrix that is the inverse of 'x'
36-
37-
inv <- x$getinverse
38-
39-
if( ! is.null( inv ) ) {
40-
## The wrapped matrix has a non NULL inverse
41-
message( "cache hit" )
42-
return inv
43-
}
44-
45-
## Calculate the inverse using solve
46-
## TODO: handle special cases more carefully, not all matrices can be inverted.
47-
inv <- solve( x$get() )
48-
49-
## Cache the result of solve()
50-
x$setinverse( inv )
51-
52-
## return the inverse
53-
inv
35+
## Return a matrix that is the inverse of 'x'
36+
37+
inv <- x$getinverse
38+
39+
if( ! is.null( inv ) ) {
40+
## The wrapped matrix has a non NULL inverse
41+
message( "cache hit" )
42+
return inv
43+
}
44+
45+
## Calculate the inverse using solve
46+
## TODO: handle special cases more carefully, not all matrices can be inverted.
47+
inv <- solve( x$get() )
48+
49+
## Cache the result of solve()
50+
x$setinverse( inv )
51+
52+
## return the inverse
53+
inv
5454
}

0 commit comments

Comments
 (0)