write while function in toy language