Commented code doesn't paste correctly into the Apple Developer Forums – it requires copy/paste multiple times to fix the formatting with comments.
// This is comment
/* c = square root(a^2 + b^2)
Calculate the distance betwen two points
@return linear distance between two CGPoints
*/
func distanceBetweenPoints(a: CGPoint, b: CGPoint) -> CGFloat {
return sqrt((b.x - a.x)*(b.x - a.x) + (b.y - a.y)*(b.y - a.y))
}Buggy code paste
- The second / of the // comment block is removed (along with the rest of the comment)
- With a block comment the * is removed from the / start of the block comment.
/
/ c = square root(a^2 + b^2)
Calculate the distance betwen two points
@return linear distance between two CGPoints
*/
func distanceBetweenPoints(a: CGPoint, b: CGPoint) -> CGFloat {
return sqrt((b.x - a.x)*(b.x - a.x) + (b.y - a.y)*(b.y - a.y))
}