Multiple Conditions for Swift 'If' Statement?

后端 未结 2 1541
一向
一向 2021-02-05 09:19

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

if a>b or c/d {
    //Do Something
}
2条回答
  •  萌比男神i
    2021-02-05 10:02

    Just like everywhere:

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

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

提交回复
热议问题