Delay not working in function other than loop So I just got an Arduino and thought I would play around a bit.

However not five minutes in I already ran into a problem.

I tried programming a simple SOS blinking light sequence. To get rid of code duplication I refactored the on and off turning of the LED into functions and then again refactored a short blink and a long blink function which are expected to turn the LED on for a short time and then for a long time.

The problem is the delay in those functions is completely ignored. 

int ledPin = 13;

void on()
{
 digitalWrite(ledPin,HIGH); 
}

void off()
{
 digitalWrite(ledPin,LOW);
}


void shortB()
{
 on();
 delay(1000);
 off();
} 

void longB()
{
 on();
 delay(2000);
 off(); 
}

void setup()
{
  pinMode(ledPin, OUTPUT); 
}

void loop()
{
 shortB();
 shortB();
 shortB();
 shortB();
 longB();
 longB();
 longB();
 shortB();
 shortB();
 shortB();  
 delay(5000);
}


My expected behavior would be that it does an SOS and then waits 5 seconds and repeats.

What really happens however is that it stay continuously lit for a second or so then turns off for 5 seconds.

Using 

on();
delay(1000);
off();


In the main loop works so I guess it simply ignores the delays that are put into the other functions. My question would be why and ho do I fix it?

I know that I can use other timer function constructs however I really think this is something that should work by default.
You have no delay in between turning the LED off and turning it back on. Add one.