如何使用标签中的用户输入打印随机结果?

How do you print a random result with user input in labels?

通过单击按钮尝试随机显示已输入数据的两个标签之一。我现在能够让第一组代码在随机挑选的 2 个标签中工作 1 个。然而,在代码的后半部分,当 3 个标签保持值时,它现在打印 3 个中的 2 个。我只想要两种方法的一个结果。请帮忙!到目前为止,这是我的代码-

              //**UPDATE**                                                                         
@IBAction func decideBttn(_ sender: Any) {

        // if there is data in more than one Label randomly pick 1 out of 2
        if valueLbl1.text?.isEmpty == false && valueLbl2.text?.isEmpty == false && valueLbl3.text?.isEmpty == true
        {



            var topics = [valueLbl1.text!, valueLbl2.text!]


             pickTopic = Int(arc4random_uniform(UInt32(topics.count-0)))
            topics.remove(at: pickTopic)

            resultLbl.text = "\(topics)"

            valueLbl1.text = ""
            valueLbl2.text = ""
            valueLbl3.text = ""
            return
        }

           // if all 3 Labels are used button will randomly pick 1 out of 3
      else if valueLbl1.text?.isEmpty == false && valueLbl2.text?.isEmpty == false && valueLbl3.text?.isEmpty == false

      {
        var topics = [valueLbl1.text!, valueLbl2.text!, valueLbl3.text!]



     pickTopic = Int(arc4random_uniform(UInt32(topics.count)))
      topics.remove(at:pickTopic)
      resultLbl.text = "\(topics)"
       // resetting variable value
     valueLbl1.text = ""
    valueLbl2.text = ""
     valueLbl3.text = ""

     return
    }

为那些想知道的人弄清楚了。

 @IBAction func decideBttn(_ sender: Any) {


     // if there is data in more than one Label randomly pick 1 out of 2

    if valueLbl1.text?.isEmpty == false && valueLbl2.text?.isEmpty == false && valueLbl2.text?.isEmpty == true
        {
            let topics = [valueLbl1.text!, valueLbl2.text!, valueLbl3.text!]

           let pickTopic = topics[Int(arc4random_uniform(UInt32(topics.count)))]

            resultLbl.text = "\(pickTopic)"
            valueLbl1.text = ""
            valueLbl2.text = ""

            return ()

        }


           // if all 3 Labels are used button will randomly pick 1 out of 3


       else if valueLbl1.text?.isEmpty == false && valueLbl2.text?.isEmpty == false && valueLbl3.text?.isEmpty == false

      {
        let topics = [ valueLbl1.text!, valueLbl2.text!, valueLbl3.text!]


   let  pickTopic = topics[Int(arc4random_uniform(UInt32(topics.count)))]


    resultLbl.text = "\(pickTopic)"
    // resetting variable value
    valueLbl1.text = ""
    valueLbl2.text = ""
    valueLbl3.text = ""

   return()


    }