— The substance of the complaint in this case is that the plaintiff, under an agreement with defendants, furnished teams and drivers for certain railroad construction work, in which said work the defendants were engaged as subcontractors, the price to be paid for the services of said teams being agreed upon; and that said services amounted to a certain sum. Certain itemized credits were then set forth in .the complaint and a balance struck, which left, as the complaint alleges, $333.50 due from defendants to plaintiff. Certain other services were then alleged, amounting in value to $112.50, and plaintiff prayed for -judgment in the sum of $466. The answer practically admitted the services rendered by the plaintiff, but alleged the value of supplies furnished to plaintiff and money paid for the benefit of plaintiff in excess of plaintiff’s demand in the sum of $253.01, and prayed for judgment for that amount. On these issues the case went to trial before the court. The court found that there was due and owing from the defendants to the plaintiff the sum of $324, and judgment was entered for that amount, from which judgment this appeal is prosecuted.
At the close of plaintiff’s case, the defendants moved for a nonsuit, which was denied, and the denial of this motion is the basis of the appellant’s only legal contention on this appeal. The contention is that, inasmuch as the exhibits which are referred to by the complaint do not in all par*233ticulars coincide with the allegations of the complaint, the exhibits must control the general averments. Johnson v. Kindred State Bank, 12 N. D. 336, 96 N. W. 588; Reynolds v. Louisville etc. R. Co., 143 Ind. 579, 40 N. E. 410, 423; Cudworth v. Gaynor, 76 Wis. 296, 44 N. W. 1103; Willard v. Davis, 122 Fed. 363; and Freiberg v. Magale, 70 Tex. 116, 7 S. W. 684, are relied upon by counsel to sustain the contention.
The rule itself is probably not objectionable when applied within proper limits. For instance, if the exhibit referred to is a contract which is the basis of the action, manifestly the rule would be a proper one to apply, and this was the case in Johnson v. Kindred State Bank, supra. There the action was founded upon a written lease, and the purpose was to s.ecure damages for a breach of the stipulation, and the court very properly held that the terms of the writing would control as determining the sufficiency of the complaint as against a demurrer. Reynolds v. Louisville etc. R. Co., supra, is a similar case, the action being upon a contract, and the rule announced was with reference to that fact. Any other rule in those cases would have annulled the general rule that the terms- of a written contract cannot be disputed or varied by parol testimony, which in those cases would have been the only effective way of proving the allegations of the complaint. While the other cases cited are not based on contract, they’are all very easily distinguished from this case, and none of them go so far as to hold that the litigant is bound by the whole of a written statement furnished by the adversary because he admits a part of said statement. In any event, if the variance had actually existed, there was no demurrer interposed to the complaint nor motion for judgment on the pleadings; but the appellants stood by and allowed the case to go to trial on the merits. Under such circumstances, the court was justified in deciding the case on its merits, and if necessary, in considering the pleadings amended to correspond with the facts proven. On the *234questions of fact involved, the record convinces us that the facts found by the court were amply justified by the testimony.
.The judgment is affirmed.
Mount, Rudkin, and Fullerton, JJ., concur.
Hadley, C. J., Crow, and Chadwick, JJ., took no part.