Opinion by
Mr. Justice Pomeroy,This action in mandamus was brought by appellants, Sarah Unger and the Unger Construction Company to compel appellees, the Township of Hampton, its manager and its zoning officer, to issue a building permit for the erection of a garden apartment complex on land in the Township owned by appellant Sarah Unger. The Township’s zoning officer had refused to issue the permit because the land upon which appellants proposed to build their apartment complex was not zoned for .commercial use. Without appealing this action of. the zoning officer to the Board of Adjustment, appellants commenced this suit, alleging in their complaint that the Township zoning ordinance was invalid because of *401procedural irregularities which had taken place at the time of its adoption. To this complaint the Township filed preliminary objections in the nature of a demurrer, which the court below sustained. Although the court granted appellants leave to amend their complaint, they brought the instant appeal1 without making any attempt to do so.
Both parties acknowledge the well settled rule that “Mandamus is an extraordinary writ which lies to compel the performance of a ministerial act or mandatory duty where there is a clear legal right in the plaintiff, a corresponding duty in the defendant, and a want of any other appropriate and adequate remedy.” Boslover A.A.B. Ass’n. v. Philadelphia Authority, 425 Pa. 535, 538, 229 A. 2d 908 (1967); Travis v. Teter, 370 Pa. 326, 330, 87 A. 2d 177 (1952). Both also agree that the preliminary objections in the nature of a demurrer *402admitted all well-pleaded, material and relevant facts in. the complaint. Lynch v. Gates, 433 Pa. 531, 534, 252 A. 2d 633 (1969); Goldman v. McShain, 432 Pa. 61, 68, 247 A. 2d 455 (1968); Hyam v. Upper Montgomery Joint Authority; 399 Pa. 446, 448-49, 160 A. 2d 539 (1960).
Appellants contend that the facts pleaded in the complaint demonstrate that the Hampton Township zoning ordinance is invalid and that they are, therefore, entitled to use their property free of its restrictibhs.2 The error of the court below, in appellants’ View, 'was its failure' to enforce this right by compelling the issuance' Of a building permit. They analogize this situation; to that in Coyne v. Prichard, 272 Pa. 424, 116 Atl. 315 (1922) where the Court held that a writ of'mandamus should have been granted to compel the issuance of a building permit where the city council had not yet promulgated any land use regulations, the piopoSed building complied with all other building regulations,' and the only objection to the building was its proposed location. They also contend that the court below- erred in concluding that another appropriate and adequate remedy was available.
Appellees’ position, on the other hand, is that where, as here, the right asserted by appellants (i.e., the right to.-a building, permit) depends upon first establishing the invalidity -of a township ordinance under which the permit was'properly refused, the right to this' permit Is not sufficiently clear to constitute the basis for a writ of mandamus. They rely upon the holding in Booz v. Reed, 398 Pa. 172, 176-7, 157 A. 2d 170 (1960) *403-that, “[m] an damps to compel a governmental ministerial officer to act in disobedience of the requirements of a relevant statute, before there has been a judicial pronouncement of the Act’s invalidity, is not the normal procedure for testing the constitutionality of. a statute.3 Appellees contend that this rule is as applicable to ordinances as to statutes and should be held controlling here, especially in light of the availability, as they assert, of an alternative, statutory procedure whereby the validity of this ordinance may be tested. .'
The court below, in a careful opinion, • upheld the arguments of the appellee Township. We think it was correct in so doing.
The logical inconsistency of appellants’ position demonstrates the inappropriateness of an action in mandamus to challenge the validity of the ordinance in question and highlights the correctness of the rule expressed in Booz v. Reed, supra. The ministerial act here sought to be compelled was the issuance of a building permit. Appellants alleged facts which, in their opinion, éstablish the invalidity of the zoning ordinance, and further alleged that “[t]here are no [other] restrictions or regulations on the use of the aforementioned land. . .” Assuming the truth of these allegations and the soundness of appellants’ legal position as to the ordinance,4 what need did appellants then have *404for a building permit which was a requirement of the invalid ordinance? None is set forth in the complaint. On the other hand, if the facts alleged do not establish the legal invalidity of the ordinance, then appellants have no right to the permit. In either situation, therefore, and regardless of its eventual determination regarding the validity of the ordinance, the court could not properly have issued the writ of mandamus.
We do not rest our decision on this ground alone. More importantly, the court below was also correct in holding that appellants had another adequate, statutory remedy available and that mandamus, therefore, would not lie. This remedy was that provided in Section 2007 of the Second Class Township Code, Act of May 1, 1933, P. L. 103, as amended, 53 P.S. §67007. That statute provided, inter alia, that any person aggrieved by a zoning officer’s decision could appeal to the Board of Adjustment, and, thereafter take a further appeal to the Court of Common Pleas if not satisfied by the Board’s action. Although repealed as of January 1, 1969, by The Pennsylvania Municipalities Planning Code, Act of July 31, 1968, P. L. , 53 P.S. §10101 et seq. (The Planning Code), the Second Class Township Code was in effect and available to appellant at the time of the denial of the building permit, and also on December 11, 1968, when the present suit was commenced.
Appellants argue, nevertheless, that The Planning Code provides them the remedy of mandamus even if they did not have it before. They point to certain provisions of Art. IX of the Code as effecting a substitution of mandamus for zoning board review where the validity of a zoning ordinance is in issue.
In the first place, as noted above, The Planning Code did not become effective until January 1, 1969, after the commencement of this proceeding. It could not serve to invest the court with mandamus jurisdic*405tion retrospectively. That point aside, however, appellant misconceives the effect of The Planning Code. "While it alters the previously existing procedure, The Planning Code does not eliminate that procedure in favor of mandamus.
Appellant relies upon §§909 and 910 of The Planning Code as evidencing a legislative intent to substitute mandamus for any other procedure. Section 909 provides in part that “[n]otking contained herein shall be construed to deny to the appellant the right to proceed directly in court, where appropriate, pursuant to Pa. R. C. P. Sections 1091 and 1098 relating to mandamus.” Section 910 stipulates that “. . . the board shall have no power to pass upon the validity of any provision of an ordinance or map adopted by the governing body.”
It must be noted that the mandamus provision of Section 909 is qualified by the phrase “where appropriate.” This does not indicate an intention to expand the function of mandamus in the area of zoning; rather it indicates an intention to leave in force judicial determinations of appropriateness, such as our holdings in Doyle v. Springfield Township, 394 Pa. 49, 145 A. 2d 695 (1958) and Lhormer v. Bowen, 410 Pa. 508, 188 A. 2d 747 (1963). Moreover, Section 910 of The Planning Code goes on to provide: “Recognizing that challenges to the validity of an ordinance may present issues of fact and of interpretation which may lie within the special competence of the board, and to facilitate speedy disposition of such challenges by a court, the board may hear all challenges wherein the validity of the ordinance presents any issue of fact or of interpretation. . . At the conclusion of the hearing the board shall decide all contested questions of interpretation and shall make findings on all relevant issues of fact which shall become part of the record on appeal to the court.” (Emphasis supplied.) Section 910, read in its entirety, *406evinces a legislative intent to preclude the hoard from making a determination of the legal validity of the ordinance; it appears that the legislature believed the resolution of a legal challenge of this sort would be better made initially by a court. But the section does not eliminate all functions of the board in such appeals; rather, it transforms the function into one of fact-finding, preparatory to a court determination as to validity.
The conclusion that appeals under The Planning Code from decisions of the zoning officer which involve challenges to the validity of the zoning ordinance are to be taken to the courts through the Zoning Hearing Board is strengthened by Section 1001 of the Code, 53 P.S. §11001, which defines “zoning appeals” to include “appeals from the decisions of the board of zoning ap-. peals and appeals upon reports of the board in proceedings to challenge the validity of any ordinance or map.” (Emphasis supplied.) Section 1002 of The Planning Code provides that the Courts of Common Pleas have jurisdiction over such appeals.
In conclusion, The Planning Code, even if applicable to this proceeding, does not change the result that would obtain under the Second Class Township Code. Under either statute, an adequate remedy was furnished to determine the validity of the zoning ordinance here in question. Mandamus was therefore improper and unavailable under either code.
Order affirmed.
Mr. Justice Roberts concurs only in the result, disagreeing with any implication in the majority opinion that-all challenges to the validity of a zoning ordinance must be brought before the zoning hearing board before they can be taken to the courts. Where such a challenge involves no issue of fact, the useless step of holding a hearing before the zoning hearing board should not be required.
Appellants, in their jurisdictional statements, assert that we have jurisdiction to consider this appeal under §1012 of The Pennsylvania Municipalities Planning Code, Act of July 31, 1968, P. L.
, 53 P.S. §11012. As the order below was not a decision rendered under The Planning Code, that statement is erroneous. This appeal being from the lower court’s refusal to grant a writ of mandamus, we do, however, have jurisdiction under the Act of June 8, 1893, P. L. 345, §29, 12 P.S. §1975.
Although in sustaining the demurrer, the court below granted appellants leave to file an amended complaint within twenty days, the opinion accompanying the order indicates the belief of the court that no amendment would cure the defect of the complaint. As a general rule, this Court has held that an order merely sustaining preliminary objections in the nature of a demurrer, without taking such further action as dismissing the complaint, is not a final order from which an appeal may be taken. This Court, however, has noted an exception to this rule where the order so restricts' the pleader with respect to further amendments as, virtually, to put him out of court on the cause of action which he seeks to litigate'. Sullivan v. Philadelphia, 378 Pa. 648, 649, 107 A. 2d 854 (1954); Local No. 163, Int’l. Union v. Watkins, 417 Pa. 120, 122, 207 A. 2d 776 (1965). The order from which this appeál has been taken falls within the exception.
The reasons given in the complaint in support of the charge of invalidity of the ordinance are three: (a) in enacting the ordinance the Township relied upon an enabling act which had been repealed; (b) the Township failed to give proper notice prior to adoption of the ordinance; (c) no comprehensive plan was established prior to adopting the ordinance.
In the Boots case at p. 177, the Court noted an. exception to this rule “where a party’s constitutional right, which he seeks to vindicate by mandamus, would be lost to him if he followed' the procedure prescribed by an assailed statute. . .,” citing as an example Penna. Co. for Ins. on Lives, etc. v. Scott, 329 Pa. 534, 198 Atl. 115 (1938). The Court went on to observe, however, that the fact that the alternative procedure to mandamus would consume a little more time and expense is not sufficient to invoke the exception.
The asserted invalidity of the ordinance is not a fact, but a conclusion of law; as such it was not admitted by- the demurrer. Hyam v. Upper Montgomery Joint Authority, supra, at 449; Adams v. Speckman, 385 Pa. 308, 309, 122 A. 2d 685 (1956).