Ferns are mostly homosporous, though some are heterosporous. The heterosporous state is a more advanced condition, that seems to have evolved independently in several groups of plants. The haploid spores are formed by meiosis inside the sporangium.