Swift的常量與變數

來源:互聯網
上載者:User

標籤:swift的常量與變數

1、使用let設定常量:

    基礎資料型別 (Elementary Data Type)的常量名全為大寫,如果由多個單片語成,則可以使用底線隔開,如:


    let YEAR=6


    let  WEEK_OF_MONTH=12



2、使用var設定變數


    通常會用小寫字母作為開始,其餘單字首大寫,例如:


    var  maxNumber=100

    var  minNumber=10;

本文出自 “平凡之路” 部落格,請務必保留此出處http://linjohn.blog.51cto.com/1026193/1618982

Swift的常量與變數

相關文章

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.