Check if IP on interface have changed - Mikrotik Script RouterOS

How To Check if IP on interface have changed. Sometimes provider gives dynamic IP addresses. This script will compare if dynamic IP address is changed.

:global currentIP;
:local newIP [/ip address get [find interface="ether1"] address];
:if ($newIP != $currentIP) do={
    :put "ip address $currentIP changed to $newIP";
    :set currentIP $newIP;
}
Credit: www.o-om.com