Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //1 задание
- let st1 = "43"
- let st2 = "4j"
- let st3 = "u34"
- let st4 = "35"
- let st5 = "21"
- var sum: Int! = nil
- if Int(st1) != nil {
- if sum == nil {sum = 0}
- sum += Int(st1)!
- }
- if let const = Int(st2) {
- if sum == nil {sum = 0}
- sum += const
- }
- if let const = Int(st3) {
- if sum == nil {sum = 0}
- sum += const
- }
- if Int(st4) != nil {
- if sum == nil {sum = 0}
- sum += Int(st4)!
- }
- if let const = Int(st5) {
- if sum == nil {sum = 0}
- sum += const
- }
- if sum == nil {
- print("Error! The all constants is not numbers")
- } else {
- print("The sum of these constants = \(sum!)")
- }
- //2 задание
- let request: (status: Int, message: String?, error_message: String?) = (234, "Ok bro", "Nonono it's shit")
- if (request.status > 200 && request.status < 300) {
- print(request.message!)
- } else {
- print(request.error_message!)
- }
- let request0: (message: String?, error_message: String?) = (nil, "No bro")
- if request0.message != nil {
- print(request0.message!)
- } else if request0.error_message != nil {
- print(request0.error_message!)
- } else {
- print("Error")
- }
- //3 задание
- var student1 : (name: String?, cars_num: String?, mark: String?) = (nil, nil, nil)
- var student2 : (name: String?, cars_num: String?, mark: String?) = (nil, nil, nil)
- var student3 : (name: String?, cars_num: String?, mark: String?) = (nil, nil, nil)
- var student4 : (name: String?, cars_num: String?, mark: String?) = (nil, nil, nil)
- var student5 : (name: String?, cars_num: String?, mark: String?) = (nil, nil, nil)
- student1.name = "Fred"
- student2.name = "John"
- student3.name = "Ann"
- student4.name = "Flora"
- student5.name = "Biggi"
- student1.cars_num = "г353ге"
- student4.cars_num = "u425wr"
- student5.cars_num = "o285ww"
- student1.mark = "3"
- student3.mark = "4"
- student4.mark = "5"
- student5.mark = "2"
- if let cars_n1 = student1.cars_num {
- if student1.mark != nil {
- print("Name: \(student1.name!), car's number: \(cars_n1), mark: \(student1.mark!)")
- } else {
- print("Name: \(student1.name!), car's number: \(cars_n1), no mark")
- }
- } else {
- if student1.mark != nil {
- print("Name: \(student1.name!), don't have a car, mark: \(student1.mark!)")
- } else {
- print("Name: \(student1.name!), don't have a car, no mark")
- }
- }
- if let cars_n2 = student2.cars_num {
- if student2.mark != nil {
- print("Name: \(student2.name!), car's number: \(cars_n2), mark: \(student2.mark!)")
- } else {
- print("Name: \(student2.name!), car's number: \(cars_n2), no mark")
- }
- } else {
- if student2.mark != nil {
- print("Name: \(student2.name!), don't have a car, mark: \(student2.mark!)")
- } else {
- print("Name: \(student2.name!), don't have a car, no mark")
- }
- }
- if let cars_n3 = student3.cars_num {
- if student3.mark != nil {
- print("Name: \(student3.name!), car's number: \(cars_n3), mark: \(student3.mark!)")
- } else {
- print("Name: \(student3.name!), car's number: \(cars_n3), no mark")
- }
- } else {
- if student3.mark != nil {
- print("Name: \(student3.name!), don't have a car, mark: \(student3.mark!)")
- } else {
- print("Name: \(student3.name!), don't have a car, no mark")
- }
- }
- if let cars_n4 = student4.cars_num {
- if student4.mark != nil {
- print("Name: \(student4.name!), car's number: \(cars_n4), mark: \(student4.mark!)")
- } else {
- print("Name: \(student4.name!), car's number: \(cars_n4), no mark")
- }
- } else {
- if student4.mark != nil {
- print("Name: \(student4.name!), don't have a car, mark: \(student4.mark!)")
- } else {
- print("Name: \(student4.name!), don't have a car, no mark")
- }
- }
- if let cars_n5 = student5.cars_num {
- if student5.mark != nil {
- print("Name: \(student5.name!), car's number: \(cars_n5), mark: \(student5.mark!)")
- } else {
- print("Name: \(student5.name!), car's number: \(cars_n5), no mark")
- }
- } else {
- if student5.mark != nil {
- print("Name: \(student5.name!), don't have a car, mark: \(student5.mark!)")
- } else {
- print("Name: \(student5.name!), don't have a car, no mark")
- }
- }
Advertisement
Comments
-
- https://opensea.io/collection/ufc-285-fight-live-coverage/activity
- https://opensea.io/collection/ufc-285-watch-party-in-las-vegas-live/activity
- https://opensea.io/collection/ufc-285-jon-jones-vs-cyril-gane-live-streaming/activity
- https://opensea.io/collection/free-livestream-ufc-285/activity
- https://opensea.io/collection/live-usa-powerlifting-at-the-arnold-sports-festiva/activity
- https://opensea.io/collection/livestream-usa-powerlifting-arnold-sports-festiva/act
- https://opensea.io/collection/kids-choice-awards-free-live-stream-2023/activityivity
- https://opensea.io/collection/livestream-usa-powerlifting-oregon-state-champion/activity
- https://opensea.io/collection/livestream-usa-powerlifting-oregon-state-champio/activity
- https://opensea.io/collection/livestream-usa-powerlifting-womens-forida-open2023/activity
- https://opensea.io/collection/livestream-usa-powerlifting-womens-forida-open/activity
- https://opensea.io/collection/usa-powerlifting-wisconsin-highschool-championship/activity
- https://opensea.io/collection/live-usa-powerlifting-wisconsin-highschool-champio/activity
- https://opensea.io/collection/livestream-usa-powerlifting-pelican-state-open2023/activity
- https://opensea.io/collection/livestream-usa-powerlifting-pelican-state-open/activity
- https://opensea.io/collection/livestream-usa-powerlifting-china-spring-classic/activity
- https://opensea.io/collection/livestreamin-usa-powerlifting-china-spring-classic/activity
- https://opensea.io/collection/-live-strength-lab-open-usa-powerlifting-australia/activity
- https://opensea.io/collection/live-strength-lab-open-usapowerlifting-australia/activity
- https://opensea.io/collection/livestream-2023-ocb-albuquerque-natural/activity
- https://opensea.io/collection/live-stream-2023-ocb-albuquerque-natural/activity
- https://opensea.io/collection/livestream-ifbb-arnold-classic-usa-2023/analytics
- https://opensea.io/collection/live-stream-ifbb-arnold-classic-2023-usa/activity
- https://opensea.io/collection/livestream-2023-arnold-sports-festival/activity
- https://opensea.io/collection/live-stream-the-arnold-sports-festival-2023/activity
- https://opensea.io/collection/livestream-2023-european-athletics-indoor-champion/activity
- https://opensea.io/collection/live-european-athletics-indoor-champion-turkiye/activity
- https://opensea.io/collection/livestream-2023-roma-ostia-half-marathon/activity
- https://opensea.io/collection/live-stream-roma-ostia-half-marathon-2023/activity
- https://opensea.io/collection/livestream-tokyo-marathon-2023/activity
- https://opensea.io/collection/live-stream-2023-tokyo-marathon/activity
- https://opensea.io/collection/livestream-macpac-motatapu-off-road-marathon-2023/activity
- https://opensea.io/collection/live-stream-macpac-motatapu-off-road-marathon-2023/activity
- https://opensea.io/collection/livestream-antalya-marathon-2023/activity
- https://opensea.io/collection/livestream-2023-vias-verdes-marathon-girona/activity
- https://opensea.io/collection/live-croatia-national-winter-throwing-championship/activity
- https://opensea.io/collection/livestream-planica-nordic-world-ski-championships/activity
- https://opensea.io/collection/livestream-slovenia-nordic-world-ski-championships/activity
- https://opensea.io/collection/live-bakuriani-fis-snowboarding-world-championship/activity
- https://opensea.io/collection/live-bakuriani-fis-freestyle-world-ski-championshi/activity
- https://opensea.io/collection/livestream-world-junior-curling-championship-2023/activity
- https://opensea.io/collection/livestream-world-junior-figure-skating-shampionshi/activity
- https://opensea.io/collection/fig-artistic-gymnastics-world-cup-doha-2023/activity
- https://opensea.io/collection/livestream-biathlon-ibu-cup-2023/activity
- https://opensea.io/collection/livestream-equestrian-global-champions-tour/activity
- https://opensea.io/collection/isu-world-single-distance-speed-skating-championsh/activity
- https://opensea.io/collection/livestream-ibu-biathlon-world-cup/activity
- https://opensea.io/collection/livestream-world-triathlon-championship-series/activity
- https://opensea.io/collection/livestream-hsbc-womens-world-championship/activity
- https://opensea.io/collection/livestream-2023-arnold-palmer-invitational/activity
- https://opensea.io/collection/livestream-hsbc-world-rugby-sevens-series/activity
- https://opensea.io/collection/livestream-vancouver-hsbc-world-rugby-seven-series/activity
- https://opensea.io/collection/livestream-fencing-world-cup-2023/activity
- https://opensea.io/collection/livestream-f1-bahrain-grand-prix/activity
- https://opensea.io/collection/free-live-f1-bahrain-grand-prix-2023/activity
- https://opensea.io/collection/livestream-uci-cycling-strade-bianchel-2023/activity
- https://opensea.io/collection/uci-cycling-strade-bianchel-live-stream-2023/activity
- https://opensea.io/collection/livestream-uci-cycling-paris-nice/activity
Add Comment
Please, Sign In to add comment
Advertisement