📖 Quick Tutorial

A Swift Tour - The Swift Programming Language (Swift 5.5)

📚 Full Guide

1 Basics

1.1 Constant and Variables

1.1.1 Examples

let abc = 10 // CONST
var abcd = 0 // VAR
var x=0, y=1, z=2 // Define multiple variables

var welcomeMsg: String
var a, b, c: String // Define multiples

1.1.2 Naming

可以用任何字符,包括unicode,emoji,和中文

1.1.3 Print

print("The current value of friendlyWelcome is \\(friendlyWelcome)")

1.2 Comments

// This is a comment.
/* This is also a comment
but is written over multiple lines. */
/* This is the start of the first multiline comment.
 /* This is the second, nested multiline comment. */
This is the end of the first multiline comment. */

1.3 Semicolons

一行代码不用加semicolons,加了之后一行可以写多个语句

1.4 Integers

1.4.1 Int Bounds

UInt8.min
UInt8.max