Swift first glance ---- syntax, swift first glance ----
Swift knowledge point
The following describes what to use to write Swift code. First, Swift does not have a header file and A. H file.
Variable Declaration
Swift variable Declaration has two keywords: var AND let. var is similar to javascript. You can declare any type of object and specify the type through var mystring: String.
var myVariable = 42myVariable = 50let myConstant = 42
Function
Swift function expression, which is the same as the javascript keyword, is func, followed by the function name. Note that the parameters in brackets are respectively the name, type String, and name day, type String, where-> String is the type of the function return parameter.
func greet(name: String, day: String) -> String { return "Hello \(name), today is \(day)."}greet("Bob", "Tuesday")
Class and Object
Class Declaration, in which the class method is defined in the braces of the class.
class Shape { var numberOfSides: Int = 0 func description() -> String { return "A shape with \(numberOfSides) sides." }}
Protocol
protocol ExampleProtocol { var simpleDescription: String { get } mutating func adjust()}
Syntax problems in taylor swift lyrics
There is a commonly used method for omitting the title of a newspaper. The active method uses ing and the passive method uses the past word segmentation.
For example, stuck in traffic is a traffic jam.
This is similar, but it is more about rhyming. It is very common to omit the lyrics. Chinese lyrics are not very syntactic.
Complete should be I have been ....
Or the Passive Meaning of "I am stuck here but you cannot see it"
However, regular articles cannot be used.
This is my idea for reference.
Haha ..........
Syntax in the lyrics of taylor swift's red album
Generally, the lyrics do not focus on syntaxes, or even some syntaxes are incorrect. Therefore, it is not good to listen to English songs and learn grammar.