Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions Learning Swift.playground/Contents.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//: Playground - noun: a place where people can play

import UIKit

func swap<T> (inout x: T, inout y: T) {
(x,y) = (y,x);
}

func flexStrings (x: String = "", y: String = "") -> String {
return x + y
}

func sumAny (x: Any...) -> String {
return String((x.map({mem in
switch mem {
case 0 as Int, "" as String:
return -10
case let s as String where Int(s) > 0:
return Int(s)!
case let n as Int:
return n
default:
return 0
}

})).reduce(0, combine: +))
}

func countFrom (from: Int, to: Int) {
if (from <= to) {
print(from)
countFrom(from + 1, to: to)
}
}
4 changes: 4 additions & 0 deletions Learning Swift.playground/contents.xcplayground
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='ios'>
<timeline fileName='timeline.xctimeline'/>
</playground>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.