zoukankan      html  css  js  c++  java
  • 第12月第26天 swift 下划线

    1.


    The _ is used to define that the parameter is not named

    If you have multiple _ it states that you do not need to name the parameters in your function call

    func myFunc(name:String, _ age:String){
    }

    myFunc(“Milo", "I'm a really old wizard")
    If you do not use the underscore you would use

    myFunc(“Milo”, age: "I'm a really old wizard")
    The _ is not necessary in function calls. It is just used to indicate that something does not to have a name.

    In regards to how you would refer to your function, You would not have to pass any name for the function call.
    But since you also don’t define a parameter type this seems to me like a invalid example (it at least doesn’t work in xCode 7 with swift 2.0)

    Edit:
    Since swift 3.0

    myFunc(name: “Milo”, age: "I'm a really old wizard")
    Should be used

    http://www.cnblogs.com/bhlsheji/p/4746072.html

    https://stackoverflow.com/questions/30876068/what-is-in-swift-telling-me

    2.

    // Set up the quad vertices with respect to the orientation and aspect ratio of the video.

    CGRect vertexSamplingRect = AVMakeRectWithAspectRatioInsideRect(self.presentationRect, self.layer.bounds);

  • 相关阅读:
    hdu 5646 DZY Loves Partition
    bzoj 1001 狼抓兔子 平面图最小割
    poj 1815 Friendship 最小割 拆点 输出字典序
    spoj 1693 Coconuts 最小割 二者取其一式
    hdu 5643 King's Game 约瑟夫环变形
    约瑟夫环问题
    hdu 5642 King's Order
    CodeForces 631C Report
    1039: C语言程序设计教程(第三版)课后习题9.4
    1043: C语言程序设计教程(第三版)课后习题10.1
  • 原文地址:https://www.cnblogs.com/javastart/p/7594951.html
Copyright © 2011-2022 走看看