You are viewing a single comment's thread. Return to all comments →
I made this work in Swift by overloading the operator
var n = Int(readLine()!)! func *(string: String, scalar:Int) -> String { let value = Array(count: scalar, repeatedValue: string) return value.joinWithSeparator("") } for i in 1..<n + 1 { print(" " * (n - i) + "#" * i) }
https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/AdvancedOperators.html
Seems like cookies are disabled on this browser, please enable them to open this website
Staircase
You are viewing a single comment's thread. Return to all comments →
I made this work in Swift by overloading the operator
https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/AdvancedOperators.html