Tankless water heaters tend to last between 15 to 20 years.
Some higher quality made Tankless water heaters may last as long as 30 to 40 years and maybe a bit longer.
My current tankless water heater is 10 years old and works and looks like new.
With a tankless water heater you have instant hot water and do not have a tank holding water that can rust out and collect sediment etc.
The tankless water heaters are usually more expensive to purchase than a tank type water heater but the tankless water heater is much better and likely to last a lot longer.
I love having instant hot water with my tankless water heater and don't have to worry about ever running out of hot water for a nice shower.