if 条件的内部是否对对象进行更改?

does the inside of if condition make changes to objects?

我无法理解这段代码:

    // assuming fm is NSFileManager object
    if ([fm moveItemAtPath: @"newfile" toPath: @"newfile2" error: NULL] == NO){
                NSLog(@"File rename Failed");
                }

moveItemAtPath 方法在 if 条件下发送消息。 它实际上是将 newfile 重命名为 newfile2 还是这只是一些测试,以确定是否可以重命名文件?

if 中的表达式将移动文件(如果可以)。 return 值可让您事后查明是否实际发生了更改。 (例如,如果您传递的路径不存在,您将收到 NO。)