在swift中乘以整数 [英] Multiplying ints in swift

查看:133
本文介绍了在swift中乘以整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是swift和iOS编程的新手,在这里慢慢学习。所以我有:

I am new to swift and iOS programming and learning slowly here. So I have:

@IBOutlet weak var timeEntered: UITextField!



@IBAction func countDown(sender: AnyObject)
    {
        var total = timeEntered.text.toInt()

        total = total *7


    }

line total = total * 7 给我错误一行上的连续语句必须以a分隔;

The line total = total *7 gives me the error "Consecutive statements on a line must be separated by a ;"

我在这里了解到你应该做(我不知道为什么但是......)

I read here that you should do ( I don't know why but...)

total = total! *7

我仍然得到同样的错误。任何帮助将受到高度赞赏。谢谢!

And still I get the same error. Any help would be highly appreciated. Thanks!

推荐答案

我认为你必须将'*'和'7'分开。试试这个总计=总计* 7

I think that you must separate the '*' and the '7'. Try this total = total * 7

这篇关于在swift中乘以整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆