当前位置: 首页 > news >正文

【Swift 60秒】01 - Variables - 变量

0x00 Lesson

When you launch Xcode it will ask you what you want to do, and l’d like you to choose “Get Started with a Playground" - this is a sandbox where you can type Swift code and see immediate results.

The default is a blank playground for iOS, which is fine, So click Next then Create to save it on your desktop.

In this lesson I want to introduce you to variables, which are places where you can store program data. They are called variables because they can vary - you can change their values freely.

Playgrounds start with a line of code that creates a variable for us:

var str = "Hello, playground"

That creates a new variable called str, giving it the value Hello, playground. On the right of the playground you can see "Hello, playground" in the output area - that’s Xcode showing us the value was set.

Because str is a variable we can change it:

str = "Goodbye"

We don’t need var the second time because the variable has already been created — we’re just changing it.


0x01 Tips

Although Swift is pretty relaxed about how you name variables, it’s usually a good idea to make them descriptive.


0x02 我的小作品

欢迎体验我的作品之一:小五笔 86 版
五笔学习好帮手
App Store 搜索即可~


相关文章:

  • 图像处理:单通道转为3通道
  • impala sql语法
  • 牛视系统源码定制,抖音矩阵系统定制开发。come here
  • 16 C++设计模式之职责链(Chain of Responsibility)模式
  • Kubernetes inotify watch 耗尽
  • LeetCode刷题(12)
  • linux系统命令-查看内存使用情况
  • (附源码)ssm经济信息门户网站 毕业设计 141634
  • 【艾思科技aisisoft.com.cn】物联网智能水族箱系统平台
  • 前后端数据接口协作提效实践
  • 分布式链路追踪技术
  • 日志收集分析平台项目-2-项目原理
  • 模型效果测试
  • 【Prism系列】Region的用法
  • 51单片机
  • Android 初级面试者拾遗(前台界面篇)之 Activity 和 Fragment
  • Linux编程学习笔记 | Linux IO学习[1] - 文件IO
  • webpack入门学习手记(二)
  • 更好理解的面向对象的Javascript 1 —— 动态类型和多态
  • 全栈开发——Linux
  • 数据仓库的几种建模方法
  • 说说动画卡顿的解决方案
  • 想使用 MongoDB ,你应该了解这8个方面!
  • 优秀架构师必须掌握的架构思维
  • 06-01 点餐小程序前台界面搭建
  • 回归生活:清理微信公众号
  • ​TypeScript都不会用,也敢说会前端?
  • ###C语言程序设计-----C语言学习(3)#
  • #数学建模# 线性规划问题的Matlab求解
  • $var=htmlencode(“‘);alert(‘2“); 的个人理解
  • (Spark3.2.0)Spark SQL 初探: 使用大数据分析2000万KF数据
  • (笔试题)分解质因式
  • (附源码)spring boot北京冬奥会志愿者报名系统 毕业设计 150947
  • (附源码)spring boot公选课在线选课系统 毕业设计 142011
  • (附源码)小程序儿童艺术培训机构教育管理小程序 毕业设计 201740
  • (黑客游戏)HackTheGame1.21 过关攻略
  • (企业 / 公司项目)前端使用pingyin-pro将汉字转成拼音
  • (十三)Maven插件解析运行机制
  • .MyFile@waifu.club.wis.mkp勒索病毒数据怎么处理|数据解密恢复
  • .Net Core缓存组件(MemoryCache)源码解析
  • .net web项目 调用webService
  • .NET 程序如何获取图片的宽高(框架自带多种方法的不同性能)
  • .NET 回调、接口回调、 委托
  • .net 写了一个支持重试、熔断和超时策略的 HttpClient 实例池
  • .Net 应用中使用dot trace进行性能诊断
  • .Net 中Partitioner static与dynamic的性能对比
  • .Net下C#针对Excel开发控件汇总(ClosedXML,EPPlus,NPOI)
  • .Net转前端开发-启航篇,如何定制博客园主题
  • .sh
  • /deep/和 >>>以及 ::v-deep 三者的区别
  • ;号自动换行
  • @EnableAsync和@Async开始异步任务支持
  • @RequestParam @RequestBody @PathVariable 等参数绑定注解详解
  • @serverendpoint注解_SpringBoot 使用WebSocket打造在线聊天室(基于注解)
  • [ C++ ] STL_stack(栈)queue(队列)使用及其重要接口模拟实现