Can't use break statement. Illegal expression error [closed] - pascal

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
In my for loop I used break statement to break loop after some match. But when I compile my code I got error for break:
Error: Illegal expression
Could you help me? I should add some unit?
for i:=0 to length(carsList)-1 do
begin
if numer <> carsList[i].numer then
begin
tmpKw2 := carsList[i].rectangleRotate(carsList[i].angle);
if((polyLine(tmpKw2,linia.p1.x,linia.p1.y,linia.p2.x,linia.p2.y))) then
begin
kolizja := true;
break:=true;
maxV := carsList[i].v;
Break;
end;
end;
end;

The code below works for me:
program Testbreak;
procedure TestBreakInFor;
var
i : Integer;
begin
for i := 0 to 10 do begin
if Odd(i) then
Break;
end;
end;
begin
TestBreakInFor;
readln;
end.
The reason you are getting the "Illegal expression" error is that you are attempting to use Break as if it were a variable (Break := True) when it is not, it is an execution flow-control instruction, like Continue. Omit the := True and it should compile corrrectly.

Related

Identifier expected on Pascal [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I keep getting an error: Identifier expected on the code snippet below.
function InitializeSetup: Boolean;
begin
if (not IsUpgrade()) then
begin
MsgBox(ExpandConstant('{cm:BaseAppMissing}'), mbError, MB_OK);
Result := False;
end;
else
begin
Result := True;
end;
end;
Then when I remove the else part, it works just fine. What is wrong with my code? The begin-end pairing seems okay. What am I missing?
function InitializeSetup: Boolean;
begin
if (not IsUpgrade()) then
begin
MsgBox(ExpandConstant('{cm:BaseAppMissing}'), mbError, MB_OK);
Result := False;
end;
end;
Remove the semicolons after the end keywords inside the if...then...else clause.

getting error in my code like PLS-00103: Encountered the symbol "NUM_LARGE" [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
DECLARE
num_small number :=20
num_large number :=10
temp NUMBER;
BEGIN
IF num_small > num_large THEN
temp := num_small;
num_small := num_large;
num_large := temp;
END IF;
DBMS_OUTPUT.PUT_LINE('num_small BEFORE = 20, AFTERWARDS = ' || num_small);
DBMS_OUTPUT.PUT_LINE('num_large BEFORE = 10, AFTERWARDS = ' || num_large );
END;
/
Missing semi-colons in declaration section. Should be
DECLARE
num_small NUMBER := 20;
num_large NUMBER := 10;
temp NUMBER;
BEGIN
IF num_small > num_large
THEN
temp := num_small;
num_small := num_large;
num_large := temp;
END IF;
DBMS_OUTPUT.PUT_LINE ('num_small BEFORE = 20, AFTERWARDS = ' || num_small);
DBMS_OUTPUT.PUT_LINE ('num_large BEFORE = 10, AFTERWARDS = ' || num_large);
END;
/

encode, decode base64 image stream delphi [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I'm trying to encode a stream of image using EncodeBase64 in encddecd.pass that save to the database in a blob field. And retrieve this using decodebase64 in a bytestream that put into a component for showing.
The process good done but image don't show in component.
Here's digest code:
procedure TProcessSave.Execute;
var
i : Integer;
fileStm : TStream;
memStm : TMemoryStream;
encode_plc : string;
begin
for i := 0 to StrList.Count - 1 do
begin
DM.idb_tbl.Append;
DM.idb_tbl.FieldByName('name').AsString := ExtractFileName(StrList.Strings[i]);
try
fileStm := TFileStream.Create(StrList.Strings[i], fmOpenReadWrite);
memStm := TMemoryStream.Create;
filestm.Seek(0, soFromBeginning);
memStm.LoadFromStream(fileStm);
DM.idb_tbl.FieldByName('file').Value := EncodeBase64(memStm.Memory, memStm.Size);
finally
fileStm.Free;
memStm.Free;
end;
DM.idb_tbl.Post;
end;
end;
and for loading:
procedure TLoadBar.Execute;
var
imgStm : TStream;
begin
with DM.idb_qry do
begin
DatabaseName := DM.idb_db.DatabaseName;
SQL.Text := 'SELECT * FROM pics_tbl';
Open;
First;
while not Eof do
begin
try
imgStm :=TBytesStream.Create(DecodeBase64(FieldByName('file').Value));
idx := imgBar_iemv.AppendImage;
imgBar_iemv.SetImageFromStream(idx, imgStm);
imgBar_iemv.ImageID[idx] := id;
finally
imgStm.Free;
end;
Next;
end;
end;
end;
and then I use imgStm for showing picture in a component but images not showing. I'm sure from component. What are your thoughts for encode and decode in my methods? Is another way that is sure for encode and decode for this problem?

case in oracle procedure [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
Is the usage of CASE wrong in the code below?
I am getting an error:
"PLS-00103: Encountered the symbol ";" when expecting one of the
following:
case The symbol "case" was substituted for ";" to continue. "
Code is :
create or replace PROCEDURE MIK_3PL_ITEM_ERRORS_PROC_1 IS
i_error_code varchar2(5);
i_desc varchar2(200);
CURSOR c_3pl_error IS
SELECT mie.client_item_id, mie.message_id,
mie.error_desc, mis.process_flag
FROM mik_3pl_item_error_etl mie,
dummy_staging mis
WHERE mie.client_item_id = mis.client_item_id
AND mie.message_id = mis.message_id;
BEGIN
dbms_output.put_line ('hello');
for i in c_3pl_error
loop
dbms_output.put_line ('in loop');
DECLARE
-- L_relations_exist VARCHAR2(1);
L_error_message VARCHAR2(255) := NULL;
L_return BOOLEAN := FALSE;
BEGIN
select error_code
into i_error_code
from mik_3pl_error_desc
where description = i.error_desc;
-- dbms_output.put_line(i_error_code);
CASE i_error_code
WHEN 'E2' THEN dbms_output.put_line ('in case');
END; -- end of CASE */
END; /*End of begin */
end loop;
END MIK_3PL_ITEM_ERRORS_PROC_1;
It needs to be:
...
CASE i_error_code
WHEN 'E2' THEN dbms_output.put_line ('in case');
END CASE; -- end of CASE */
END;
It's trying to treat the END; as the end of the block - matching that END with the BEGIN - and it knows the case is still open.
The documentation for the CASE statement shows that. (Not to be confused with a CASE expression, which does just have END. Ahem. Thank you Nicholas!)

How can i fix this trigger it looks ok to me, i'm getting a PLS-00103 [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
the following trigger code applies a discount to the bill after a certain amount of visits but i'm getting the following error PLS-00103: Encountered the symbol "=" when expecting one of the following: := . ( # % ; indicator
CREATE OR REPLACE TRIGGER CHECK_DISCOUNT
BEFORE INSERT OR UPDATE OF C_NO,BILL ON APPOINTMENT
FOR EACH ROW
DECLARE
CURSOR C_APPTMNT
IS
SELECT C_NO,COUNT(C_NO)
FROM APPOINTMENT GROUP BY C_NO;
V_C_NO APPOINTMENT.C_NO%TYPE;
VISIT NUMBER(2);
V_TEN NUMBER(3):=0.9;
BEGIN
OPEN C_APPTMNT;
FETCH C_APPTMNT INTO V_C_NO,VISIT;
IF VISITS = 3 AND :NEW.C_NO = V_C_NO THEN
:NEW.BILL := :NEW.BILL * V_TEN
END IF;
END;
/
Getting a new error
PLS-00103: Encountered the symbol "END" when expecting one of the
following:
. ( * # % & = - + ; < / > at in is mod not rem
<> or != or ~= >= <= <> and or like
between ||
The symbol ";" was substituted for "END" to continue.
Assignment needs a :
:NEW.BILL := :NEW.BILL * V_TEN;

Resources