mirror of
https://git.tonybark.com/tonytins/swiftlyfox.git
synced 2026-05-12 05:43:30 -04:00
Shape class in Playground
This commit is contained in:
parent
82077a9bb2
commit
1c40a688e4
1 changed files with 11 additions and 0 deletions
|
|
@ -26,3 +26,14 @@ func calcStats(scores: [Int]) -> (min: Int, max: Int, sum: Int) {
|
||||||
|
|
||||||
let stats = calcStats(scores: [5, 3, 100, 3, 9])
|
let stats = calcStats(scores: [5, 3, 100, 3, 9])
|
||||||
let sum = stats.sum // 120
|
let sum = stats.sum // 120
|
||||||
|
|
||||||
|
class Shape {
|
||||||
|
var numberOfSides = 0
|
||||||
|
func simpleDescription() -> String {
|
||||||
|
return "A shape with \(numberOfSides) sides."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var shape = Shape()
|
||||||
|
shape.numberOfSides = 7
|
||||||
|
var shapeDesc = shape.simpleDescription()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue