Member Avatar for Lone | Wolf

hello, I'm new to the language and so far as I can tell this should work but it isnt. Sorry its probably just a newb mistake but i've spent hours on this silly error (and used search).

var call_start, call_length : integer; discount, cost: real; answer: char; const normal_price = 40; VAT = 0.175; begin repeat //repeat 1 writeln ('please input call start time in hours'); readln (call_start); until (call_start >= 0) or (call_start <24); repeat //repeat 2 writeln ('please input call length'); readln (call_length); until call_length > 0; //repeat 2 end discount := 1; if (call_start > 18) then discount := 0.5 else if (call_start > 13) then discount := 0.8; cost := call_length * normal_price * discount * VAT; if call_length > 60 then cost := cost * 0.8; writeln ('the price for your call was', cost); repeat //repeat 3 writeln ('do you wish to continue (Y/N)'); readln (answer); until (answer = 'Y') or (answer = 'N'); //repeat 3 end {it wants the end here for some reason but that excludes loop} until (answer = 'N'); //repeat 1 end end. [Error] Project2.dpr(30): 'END' expected but 'UNTIL' found
Member Avatar for LizR

if you look at:

until (call_start >= 0) or (call_start <24); repeat //repeat 2 writeln ('please input call length'); readln (call_length); until call_length > 0;

You have an until without a repeat. Hence you get a confused bit.

Member Avatar for Lone | Wolf

Ah thank you for the help. Can't believe I never noticed that.

Member Avatar for LizR

No worries.

Member Avatar for Lone | Wolf

A quick one of question. How do i mark this thread as solved?

Member Avatar for LizR

Dunno I never asked a question here, I assume theres a button to say "resolved" somewhere.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.