在 JavaScript 中,|| 运算符将返回第一个非错误评估操作数。例如:
var x = null;
var y = "yup";
var z = x || y; // z is now "yup"
有没有对应的Objective-C?
例如:
NSString *x = nil;
NSString *y = @"yup";
NSString *z = x ... y; // z should now be @"yup", if "..." were an operator
请注意:'||' 在 JavaScript 中做短路