Ros scripting translation

Hello everyone, I need to modify this script in mikrotik language using global variables:

var bool ConnWasUp == false;
while true;
if (ConnWasUp = true) then
if (connection down) then reboot;
sleep 2;
if (connection up) then ConnWasUp == True


Thanks very much

Do not open multiply topics for the same problem
http://forum.mikrotik.com/t/script-reboot-on-connectivity-down/167822/1