Swift'If'声明的多重条件? [英] Multiple Conditions for Swift 'If' Statement?

查看:107
本文介绍了Swift'If'声明的多重条件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法写一个If语句是Swift,如下所示?

Is there a way to write an If statement is Swift such as the following?

if a>b or c/d {
    //Do Something
}


推荐答案

就像所有地方一样:

if a > b || d % c == 0 {
   // do sth
}

I假设你的 c / d 意味着你希望 d c的倍数

I assume your c/d means you'd like d to be a multiple of c.

这篇关于Swift'If'声明的多重条件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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