Nuances of shetch Code

I have a sample piece of code built from one of the embedded sketches
Yes this is a very simple code and I am new at arduino programming but I have coded in other languages like C before and as far as I can tell this should be working I have tried different iterations with different forms of the if condition but to no success

Here is the sketch and what I simply want to do is to flash between line 13 the onboard LED and an external LED on line 7 the switch will occur faster and faster until the delay is 0 then it starts slowing down until the delay hits 1000 and then loops back again continuously

Turns on an LED on for one second, then off for one second, repeatedly.

This example code is in the public domain.

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 7;
int obled = 13;
int dlay = 100;
int val = 1;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
pinMode(obled, OUTPUT);

// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(dlay); // wait for some time
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
digitalWrite(obled, HIGH); // turn the obLED on (HIGH is the voltage level)
delay(dlay); // wait for some time
digitalWrite(obled, LOW); // turn the obLED off by making the voltage LOW

if ((dlay <= 0) || (dlay >=1000)) {
val= val * -1;
dlay = dlay + (val * 100);

It seems simple enough and should do what I want it to do but it cycles from fast to slow but then never goes fast again it is some how stuck on the high end of the delay value. Is there a nuance of the sketch code I am missing.

OK now it seems to be working just fine is that another nuance

Perhaps one of the uploads failed? Check for error messages each time...