ããç¶æ ãé åã§æã¤ãã¨ã«ãã¦ãããç¶æ ã¨å¥ã®ããç¶æ ãæ¯è¼ããæ¶ããè¦ç´ ã¨ç¾ããè¦ç´ ãç¥ãããï¼ãã ãã©ã®ã¤ã³ããã¯ã¹ã®è¦ç´ ãæ¶ãããããã®ãã¯æ°ã«ããªãï¼ã¨ããç¶æ³ãæ³å®ãåé åã¯éè¤ããè¦ç´ ãæããªããã®ã¨ããã Ruby ã®é åã¯éåã®ããã«æ±ããã¨ãã§ãããã¨ãæ´»ç¨ããã¨ãåç´ã«ãããªæãã§æ¸ããã def array_diff(older, newer) # å¼æ°ã¯ã©ã£ã¡ãé å removed = older - newer # é å older ããé å newer ã«åå¨ããè¦ç´ ãé¤å» added = newer - older # é å newer ããé å older ã«åå¨ããè¦ç´ ãé¤å» return removed, added # æ¶ããè¦ç´ ãããªãé åã¨ç¾ããè¦ç´ ãããªãé åãè¿ã end p array_diff(["a", "b", "c", "d", "e
{{#tags}}- {{label}}
{{/tags}}