inout lets a Swift function modify the caller’s original variable instead of a temporary copy. Pass the argument with &, and changes persist after the function returns. section 2.2
Marking a maze path
func markMaze(_ maze: inout Maze, path: [MazeLocation], start: MazeLocation, goal: MazeLocation) { ... }\n\nmarkMaze(&maze, path: path, start: start, goal: goal)\n\nThe function marks path cells and replaces the start and goal cells in the original maze, so printing maze afterward displays the solution. section 2.2
// A Cell represents the status of a grid location in the maze
enum Cell: Character {
case Empty = "O"
case Blocked = "X"
case Start = "S"
case Goal = "G"
case Path = "P"
}
typealias Maze = [[Cell]]
Use the Maze and Cell definitions to see the mutable grid that markMaze updates through inout. section 2.2
