Swift Basics-Operator

Source: Internet
Author: User
Tags vars

(1) Subtraction

(2) Three mesh operation, remember that the following space if the error will not be added. It is estimated that it is an apple bug.

(3) Aggregation operator, save a judgment, very humane

(4) Interval operator

  1. Subtraction, wait.
  2. Let A = 2
  3. Let B = 3
  4. var C = 0
  5. C++
  6. ++c
  7. c+=2
  8. c-=2
  9. c*=2
  10. c/=2
  11. Trinocular operator
  12. A==b? "x": "y"
  13. Nil aggregation operator
  14. var sa:string? = "A"
  15. var sb:string = "B"
  16. SA = Nil
  17. Sa?? Sb
  18. Interval operator
  19. Closed interval
  20. For index in 1 ... Ten {
  21. println (Index)
  22. }
  23. Semi-closed interval
  24. For index in 1..<10 {
  25. println (Index)
  26. }
  27. Let arr = ["x","y","Z"]
  28. For i in 0..<arr. count{
  29. println (Arr[i])
  30. }

Swift Basics-Operator

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.