2014年8月16日土曜日

開発環境

Practical Programming: An Introduction to Computer Science Using Python 3 (Pragmatic Programmers) (Paul Gries (著)、Jennifer Campbell (著)、Jason Montojo (著)、Lynn Beighley (編集)、Pragmatic Bookshelf)のChapter 7(Using Methods)、7.6(Exercises) 9, 10.をSwiftで考えてみる。

7.6(Exercises) 9, 10.

コード(Xcode)

main.swift

//
//  main.swift
//  sample9
//
//  Created by kamimura on 8/16/14.
//  Copyright (c) 2014 kamimura. All rights reserved.
//

import Foundation

let season:String = "summer"
println("I love \(season)!")
println("I love " + season + "!")

let side1:Int = 3
let side2:Int = 4
let side3:Int = 5

println("The sides have lengths \(side1), \(side2), \(side3)")
println("The sides have lengths " + String(side1) + ", " + String(side2) + ", " + String(side3))

入出力結果(Console Output)

I love summer!
I love summer!
The sides have lengths 3, 4, 5
The sides have lengths 3, 4, 5
Program ended with exit code: 0

0 コメント:

コメントを投稿