简体   繁体   English

if 语句:赋值不是表达式,在这个上下文中只允许表达式 kotlin

[英]If statement: Assignments are not expressions, and only expressions are allowed in this context kotlin

I keep getting an error message in my if statement:我的 if 语句中不断收到错误消息:

 fun someFunction(){
    if (requestCode == 0 && resultCode = Activity.RESULT_OK && data != null) { 
        // Do stuff
    }
 }

应该是resultCode == Activity.RESULT_OK

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 分配不是表达式,在这种情况下只能使用表达式-Kotlin - Assignments are not expressions and only expressions are allowed in this context - Kotlin 赋值不是表达式,在这种情况下只允许使用表达式 - Kotlin - Assignments are not expressions, and only expressions are allowed in this context - Kotlin Android Studio 错误“赋值不是表达式,在此上下文中只允许使用表达式。” - Android Studio Error “Assignments are not expressions, and only expressions are allowed in this context.” 此语言级别不允许使用Android Studio Lambda表达式 - Android Studio Lambda expressions are not allowed at this language level Kotlin (Android Studio) 意外标记(使用“;”分隔同一行上的表达式) - Kotlin (Android Studio) Unexpected tokens (use ';' to separate expressions on the same line) 错误:“只允许 Kotlin 标准库使用‘kotlin’包” - Error: "Only the Kotlin standard library is allowed to use the 'kotlin' package" 使用Lambda表达式和Butterknife - Use Lambda expressions and Butterknife 如何在Android Studio中自动替换为Lambda表达式 - How to auto replace into lambda expressions in Android Studio 如何将代数表达式显示为字符串? - How can I display algebraic expressions as a String? 错误:-source 1.7不支持lambda表达式(使用-source 8或更高版本来启用lambda表达式) - Error: lambda expressions are not supported in -source 1.7 (use -source 8 or higher to enable lambda expressions)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM