print输出
来源:互联网 发布:如何延长淘宝付款时间 编辑:程序博客网 时间:2024/06/09 18:20
在Swift 3.0之后,就抛弃了以前版本的println,只使用print来进行控制台的输出。在这里就简单说明一下常用的print输出方式。
1、最常用的是直接使用
print("hello, swift")
2、需要同时输出多个参数时,使用逗号(,)分割
print("hello", " swift")
3、若需要输出一组字符串中带有某个甚至某些变量值时,可以使用字符串斜插的方式输出
let a = "swift"print("hello \(a)")
4、print默认的分隔符为空格( ),结束符为换行("\n"),若想要指定分隔符或换行符,可以使用print的另外几种重载函数
//指定分隔符为*print("hello", "swift", separator: "*")//指定结束符为#print("hello", terminator:"#")//指定分隔符为*,并指定结束符为#print("hello", "swift", separator: "*", terminator: "#")
print(String.init(format: "%.2f", 1.222))
阅读全文
0 0
- print输出
- print没有输出结果
- python 的print输出
- print输出字体特效
- 四、print输出结果
- print 格式化输出
- Python print 格式化输出
- python print输出中文
- python print格式化输出
- print输出乱码
- 【C语言】print 输出
- python print格式化输出
- 输出工具库Print
- print 中文输出乱码
- Python print格式化输出
- print 格式化输出
- Print格式化输出
- python print格式化输出
- ionic添加百度地图定位插件cordova-plugin-baidu-geolocation.git
- mysql中删除数据的方法总结
- 给大家一点福利吧,HTML做的天气预报。(转)
- 详解--康托展开
- Openstack常见问题解决------网络与服务
- print输出
- a[s++] = a[e]
- ZOJ 1149 Dividing(穷举)
- 51nod 1138 等差数列公式
- Web App、Hybrid App与Native App的区别
- 2017百度之星复赛 1003 Pokémon GO 递推
- Linux GPIO Manipulation via System File System, sysfs
- Window内存管理方式:页式 段式 段页式
- 阶乘中因子k的个数