## Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

# withRange range

Hi all, I'm getting a fault message with the perameters local and external for func surroundingPointsWith.. I've just writen this code exact I think from the video and he had no faults . its telling me i should not have the withRange and i should delete it to fix the problem.

struct Point { let x: Int let y: Int

```func surroundingPointsWith(withRange range: Int = 1) -> [Point]
{
var results: [Point] = []
for xCoord in (x-range)...(x+range){
for yCoord in (y-range)...(y+range)
let coordinatePoint = Point(x: xCoord, y: yCoord)
results.append(coordinatePoint)
{

}
return results

}

}
```

}

let coordinatePoint = Point(x: 0, y: 0) coordinatePoint.x

The problems are (1) a missing curly brace and (2) a reversed curly brace:

```struct Point {
let x: Int
let y: Int

func surroundingPointsWith(withRange range: Int = 1) -> [Point] {
var results: [Point] = []
for xCoord in (x-range)...(x+range){
for yCoord in (y-range)...(y+range) { //missing {
let coordinatePoint = Point(x: xCoord, y: yCoord)
results.append(coordinatePoint)
} //need } instead of {
}
return results
}
}

let coordinatePoint = Point(x: 0, y: 0)
coordinatePoint.x
```

Thanks I amended the curly braces but that didn't solve the problem . For some reason it didn't like the "with" part of the withRange . I tried it with lots of other Double words such as allRange etc and it worked fine . Haven't a clue why .

The errors saying 'with' implied for the first part of the method; did you mean to name this parameter 'range'.

Ok ! Just after writing the above I just deleted the space in between withRange and range and then put the space back in . It works fine now . Very strange !!!