2014年9月15日月曜日

開発環境

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

9.10(Exercises) 13.

コード(Xcode)

main.swift

//
//  main.swift
//  sample13
//
//  Created by kamimura on 9/15/14.
//  Copyright (c) 2014 kamimura. All rights reserved.
//

import Foundation

for x in 0..<7 {
    for y in 0..<(x + 1) {
        print("T")
    }
    println()
}

入出力結果(Console Output)

T
TT
TTT
TTTT
TTTTT
TTTTTT
TTTTTTT
Program ended with exit code: 0

0 コメント:

コメントを投稿