public class Solution {\n func equal(_ a: Int, _ b: Int) -> [Bool] {\n return [a === b, a == b]\n }\n}\n在Swift中,不能使用&运算符来比较两个整数的引用。在这种情况下,应该使用===运算符来比较两个对象的引用。此外,应该使用[===, ==]来返回一个包含两个比较结果的数组。\n\n下面是修改后的代码:\n\nswift\npublic class Solution {\n func equal(_ a: Int, _ b: Int) -> [Bool] {\n return [a === b, a == b]\n }\n}\n


原文地址: https://www.cveoy.top/t/topic/p8SG 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录