Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. import UIKit
  2.  
  3. var kappa = "kappa"
  4. var newInt = 69
  5. var newDouble = 21.37
  6.  
  7. let newerInt: Int = 12
  8. let newerDouble: Double = 12.21
  9. let pogu: String = "pogu"
  10.  
  11. var concatenateString = kappa + " " + String(newInt)
  12. var concatenateString2 = "\(pogu) \(newerInt)"
  13.  
  14. var array = [132,23,3546,77,123,123]
  15. var dictionary = ["gwe":"one", "rty":"two", "uio":"three"]
  16.  
  17. var lottoResults = ["29-11-14":[4, 5, 21, 30, 31, 49], "27-11-14": [5, 8, 10, 19, 23, 40]]
  18.  
  19. var emptyDictionary = [Character: Int]()
  20. let letters = ["A","B","C","D","E","F","G","H","I","J"]
  21. var j = 1
  22. for i in letters{
  23. emptyDictionary[Character(i)] = j
  24. j += 1
  25. }
  26. print(emptyDictionary)
  27.  
  28. for i in lottoResults{
  29. print(i.key)
  30. for j in i.value{
  31. print("- \(j)")
  32. }
  33. }
  34.  
  35. func nwd(a: Int, b: Int) -> Int{
  36. if(b == 0){
  37. return a
  38. } else {
  39. return nwd(a: b, b: (a - b * Int(floor(Double(a)/Double(b)))))
  40. }
  41.  
  42. }
  43.  
  44. print (nwd(a: 30, b: 45))
  45.  
  46. func nwd2(a: Int, b: Int) -> (Int,Int,Int){
  47. var result = 0
  48. if(b == 0){
  49. result = a
  50. } else {
  51. result = nwd(a: b, b: (a - b * Int(floor(Double(a)/Double(b)))))
  52. }
  53. return(result, a/result, b/result)
  54.  
  55. }
  56.  
  57. print (nwd2(a:30,b:45))
  58.  
  59. //let numbers4 = lottoResults.map({ number in number % 2 })
  60.  
  61. class NamedObject
  62. {
  63. var Name = "Klasa."
  64. func describe(){
  65. print("Nazwa to \(Name)")
  66. }
  67. }
  68.  
  69. let klasa = NamedObject()
  70. klasa.describe()
  71. class Sphere:NamedObject{
  72. var radius = 6
  73. super.init(rad: Int, name: String) {
  74. self.radius = rad // "self" used to distinguish
  75. self.Name = name // arguments from properties
  76. }
  77.  
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement