gpt4 book ai didi

javascript - 警报消息出现问题

转载 作者:行者123 更新时间:2023-11-30 13:00:04 25 4
gpt4 key购买 nike

当我不输入相同的密码时,我试图让“密码丢失”工作,当没有给出答案时,我尝试让“helo fill everything”工作。

问题是它直接跳过前两个语句,然后跳到最后一个警报“AAAAA”..(对代码的第一部分感到抱歉..)

if(userPassword != userPasswordRepeat)
{
displayAlertMessage(alarm: ("password missing"));
return
}
if(userEmail == "" || userPassword == "" || userFirstName == "" || userLastName == "")
{
//vis alarm besked 2
displayAlertMessage(alarm: ("helo fill everyting"));
return
}

}
func displayAlertMessage(alarm:String)
{
let myAlert = UIAlertController(title: "Alert", message: "AAAAA", preferredStyle: UIAlertControllerStyle.alert);

let okAction = UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil)


myAlert.addAction(okAction);


self.present(myAlert, animated: true, completion: nil)
}
}

`

最佳答案

使用参数alarm而不是AAAAA

let myAlert = UIAlertController(title: "Alert", message: alarm, preferredStyle: UIAlertControllerStyle.alert);

关于javascript - 警报消息出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39950072/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com