Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- var kappa = "kappa"
- var newInt = 69
- var newDouble = 21.37
- let newerInt: Int = 12
- let newerDouble: Double = 12.21
- let pogu: String = "pogu"
- var concatenateString = kappa + " " + String(newInt)
- var concatenateString2 = "\(pogu) \(newerInt)"
- var array = [132,23,3546,77,123,123]
- 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 = nwd(a: b, b: (a - b * Int(floor(Double(a)/Double(b)))))
- }
- return(result, a/result, b/result)
- }
- print (nwd2(a:30,b:45))
- //let numbers4 = lottoResults.map({ number in number % 2 })
- class NamedObject
- {
- var Name = "Klasa."
- func describe(){
- print("Nazwa to \(Name)")
- }
- }
- let klasa = NamedObject()
- klasa.describe()
- class Sphere:NamedObject{
- var radius = 6
- super.init(rad: Int, name: String) {
- self.radius = rad // "self" used to distinguish
- self.Name = name // arguments from properties
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement