It depends upon the system you are studying diving with.
PADI is based upon American Navy standards, BS-AC is based upon Royal Navy experience and studies.
I am a BS-AC Club Instructor and the BS-AC88 tables allow you to fly once you have a tissue code of B, that is as little as 4 hours from surfacing as a tissue code G. Taken from a level 1 table (Air pressure of 984millibars). Not advisable though, for safety's sake, you can never tell how susceptible you are to Decompression Illness.
The greater the depth the shorter the exposure to the increased pressure, you can be saturated (needing a deco stop) after 51 minutes at 18 metres, that is just on one dive.
For example; after a dive at 18 metres for between 17mins & 37mins, you will be a code D, wait just over an hour, change to a code C. Dive to 15metres, for no more than 24 minutes and surface a code F. Code G is a decompression stop code. Wait for 4 hours to a code B, 15 hours for a code A (no nitrogen left in the body).
A beginner is never recommended to do a decompression dive.
The tables are written to air on the side of safety.
It is always wiser to extend the time between surfacing and flying.
Before worrying about this question, whichever system you choose to dive with, study hard, learn to be a good diver then you will be able to make your own educated judgement as whether to dive & then fly.
Enjoy your training & studying, and welcome to the wonderful world of diving.
P.S: I remember, during the Dive Leader theory lessons, the bottom of most slides had the word 'death' on it.