Can you legally leave school when 18?

yes - but first you need to pass the 6th grade