在介绍Playground之前,我先罗列一些本人觉得有点重要然而零碎的知识点。
1. Swift语法,每句话之后不用加分号,但也可以加分号。但如果写在一行的话,必须加分号。
2. Swift严格要求变量在使用之前必须进行初始化(后面讲解构造方法的时候,也会介绍)
3. 用let申明常量,用var来申明变量 let
radius = 10 var age = 20
...
分类:
编程语言 时间:
2015-07-21 10:47:23
阅读次数:
142
Description描述Let P1, P2, … ,PN, … be a sequence of prime numbers. Super-prime number is such a prime number that its current number in prime numbers s...
分类:
其他好文 时间:
2015-07-20 14:24:06
阅读次数:
121
1 import Foundation 2 3 //加载网络数据,查找数据的字符串 4 let dataurl = "http://api.k780.com:88/?app=weather.city&&appkey=10003&sign=b59bc3ef6191eb9f747dd4e83c99f.....
分类:
移动开发 时间:
2015-07-20 12:34:55
阅读次数:
133
history|tail-1|cut-d‘‘-f2计算命令:1)let例;letC=$A+$B2)C=$[$A+$B]3)C=$(($A+$B))4)expr命令例:C=`expr$A+$B`退出脚本;exit例;exit0条件测试:1)[空格表达式空格]2)test表达式3)[[空格表达式空格]]ifgrep‘bash‘/etc/shadowif后面为非零值为假文件测试-efile测试文件是..
分类:
系统相关 时间:
2015-07-19 23:45:15
阅读次数:
275
5.12 结构体
结构体是一个表示复杂数据类型的方式.例如,你可以计算二维坐标,我们需要x和y的值:
let origin_x = 0;
let origin_y = 0;
一个结构体就可以让你将两个值合并成一个独立的值:
struct Point {
x: i32,
y: i32,
}
fn main() {
let...
分类:
其他好文 时间:
2015-07-19 18:11:09
阅读次数:
213
//
// main.swift
// 闭包
//
// Created by 朱敏 on 15/6/15.
// Copyright (c) 2015年 helinyu. All rights reserved.
//
import Foundation
let names = ["Lily","Anna","Duty","Poly","Gray"...
分类:
编程语言 时间:
2015-07-19 18:03:22
阅读次数:
151
5.11 可变性
可变性,就是改变某些值的能力,Rust语言和其他语言有很大的区别.第一点就是Rust默认是不可变的:
let x = 5;
x = 6; // error!
我们可以引入mut关键字来增加可变性:
let mut x = 5;
x = 6; // no problem!
这是一个可变绑定.当一个绑定时可变的时候,你可以改变...
分类:
其他好文 时间:
2015-07-19 16:32:36
阅读次数:
254
Define an interface for creating on object, but let subclasses decide which class to instantiate Factory Method lets a class defer instantiation to subclasses.
定义一个用于创建对象的接口,让子类决定实例化哪一类。
抽象产品类Pr...
分类:
其他好文 时间:
2015-07-18 14:13:34
阅读次数:
149
传递参数 在bash shell 编程中, 向函数传递的参数仍然是位置参数的方式来传递的, 而不能传递数组等其他形式的变量, 这与C语言 或JAVA语言的函数传递是不同的. #!/bin/bash half() { let "n = $1"...
分类:
其他好文 时间:
2015-07-18 13:56:46
阅读次数:
118
DescriptionAstronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level...
分类:
其他好文 时间:
2015-07-17 17:34:22
阅读次数:
144