博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
斯威夫特山地车_斯威夫特| 打印“ Hello World”程序
阅读量:2533 次
发布时间:2019-05-11

本文共 1734 字,大约阅读时间需要 5 分钟。

斯威夫特山地车

Swift is a language that is used to create an application for the iOS software included in Apple products. It was derived from the objective C and is an Object Oriented programming language. Let us start with the basic program of Swift i.e. Hello World.

Swift是一种语言,用于为Apple产品中包含的iOS软件创建应用程序。 它源自目标C,是一种面向对象的编程语言。 让我们从Swift基本程序即Hello World开始

This program will give you an idea of the syntax and how we can display the output on the screen. Like any other language, Swift also has a software i.e. XCode, where the program is run and commands are executed.

该程序将为您提供语法概念以及如何在屏幕上显示输出。 像任何其他语言一样,Swift也有一个软件,即XCode ,可以在其中运行程序并执行命令。

Open XCode terminal and type the following program

打开XCode终端并键入以下程序

import Foundationprint("Hello, World!");

Hit enter key to run the program and the output will be shown.

按Enter键运行程序,将显示输出。

Output

输出量

Hello, World!

Screenshot with code and the output i.e. Xcode terminal

屏幕截图,带代码和输出,即Xcode终端

Explanation:

说明:

Here, printf function is used to show the text quoted in " " on the output screen as in C.

在这里, printf函数用于在输出屏幕上像C一样显示在“”中引用的文本。

Semicolon ";" is the must after every end of the command as similar in C/C++ etc.

分号“;” 与C / C ++等类似,是命令每一行之后的必需内容。

// is used to comment in a program as depicted above.

//用于在程序中如上所述进行注释。

import Foundation is a library which is used to access all the functions present that header file.

import Foundation是一个库,用于访问该头文件中提供的所有功能。

There can be many such header files that can be imported.

可以导入许多此类头文件。

Whereas, "program ended with exit code: 0" at the end shows that there are no further programs to be run.

结尾处的“程序以退出代码0结尾”表示没有其他程序要运行。

Stay connected with us to know more about Swift coding in our further tutorials.

与我们保持联系,以在进一步的教程中进一步了解Swift编码。

翻译自:

斯威夫特山地车

转载地址:http://pcvzd.baihongyu.com/

你可能感兴趣的文章
数据库TCPIP协议开了,但还是远程连不上
查看>>
一般处理程序在VS2012中打开问题
查看>>
C语言中的++和--
查看>>
thinkphp3.2.3入口文件详解
查看>>
POJ 1141 Brackets Sequence
查看>>
Ubuntu 18.04 root 使用ssh密钥远程登陆
查看>>
linux 单机跨进程通信
查看>>
Servlet和JSP的异同。
查看>>
虚拟机centOs Linux与Windows之间的文件传输
查看>>
ethereum(以太坊)(二)--合约中属性和行为的访问权限
查看>>
IOS内存管理
查看>>
监听系统键盘的方法
查看>>
Mysql两个引擎对比
查看>>
测试书籍推荐
查看>>
php魔术方法
查看>>
BZOJ4025 : 二分图
查看>>
SQL server中的SQL语句拼接
查看>>
17、生命周期-BeanPostProcessor在Spring底层的使用
查看>>
jQuery表单验证
查看>>
MySQL中数据表的查操作
查看>>