Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- var myString = "Ala ma kota!"
- var myInteger = 12
- var myDouble = 12.21
- let myConstantInteger: Int = 12
- let myConstantDouble: Double = 12.21
- let myConstantString: String = "Ala ma kota!"
- var concatenateString = myString + " " + String(myInteger)
- var concatenateString2 = "\(myString) \(myInteger)"
- var array = [1,2,3,4,5,6,7]
- var dictionary = ["gwe":"one", "rty":"two", "uio":"three"]
- var lottoResults = ["29-11-14":[4, 5, 21, 30, 31, 49], "27-11-14": [5, 8, 10, 19, 23, 40]]
- var emptyDictionary = [Character: Int]()
- let letters = ["A","B","C","D","E","F","G","H","I","J"]
- var j = 1
- for i in letters{
- emptyDictionary[Character(i)] = j
- j += 1
- }
- print(emptyDictionary)
- for i in lottoResults{
- print(i.key)
- for j in i.value{
- print("- \(j)")
- }
- }
- func nwd(a: Int, b: Int) -> Int{
- if(b == 0){
- return a
- } else {
- return nwd(a: b, b: (a - b * Int(floor(Double(a)/Double(b)))))
- }
- }
- print (nwd(a: 30, b: 45))
- func nwd2(a: Int, b: Int) -> (Int,Int,Int){
- var result = 0
- if(b == 0){
- result = a
- } else {
- result = nwd2(a: b, b: (a - b * Int(floor(Double(a)/Double(b)))))
- }
- return(result, a/result, b/result)
- }
- print (nwd2(a:30,b:45))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement