FAS Computer Services to Harvard University IT: (617) 495-7777.
|
Swift is
programming language for iOS and OSX from Apple.
Swift code works side-by-side with Objective-C.
XCode is the IDE. While typing code, the compiler
always gives feedback. This allows "swift programming".
|
Here is the Ulam (Collatz or 3n+1) game in Swift together with a screen
shot during writing. Ulam.playground.tgz
|
// Ulam Game
for n in 1...20 {
var k=n
var s=0
while k>1 {
s++
if k % 2 == 0 {
k=k/2
} else {
k=3*k+1
}
}
println(s)
}
println("end")
|