美文网首页
AppleScript - copy

AppleScript - copy

作者: 不写昵称 | 来源:发表于2018-07-29 17:46 被阅读0次

    copy会为新变量开一个新的内存
    语法:copy 旧变量 to 新变量

    举例:

    set arr1 to {1, 2, 3, 4}
    --set arr2 to arr1 --使用set,内存地址相同,改变arr2时,arr1也会改变
    copy arr1 to arr2  -- 使用copy,内存地址不同,改变arr2时,arr1不会变
    set the item 2 of arr2 to 5
    get arr1
    

    相关文章

      网友评论

          本文标题:AppleScript - copy

          本文链接:https://www.haomeiwen.com/subject/svctvftx.html