Free Pascal Syntax Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow fatal syntax error expected but var found the company Business Learn more about hiring developers or posting ads with us Stack Overflow
Fatal: Syntax Error, ; Expected But Else Found
Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of
Fatal Syntax Error . Expected But End Of File Found
4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up What's wrong with this Pascal syntax? up vote 0 down vote favorite I can't understand what's going on
Expected But Found
here. Can you give me a hand? This is the problematic code: While not EOF(Archi) do begin index:= index + 1; Read(Archi, Alumno[index]); Promes[index] := (Alumno[index].nota1 + Alumno[index].nota2) / 2; if Promes[index] >= 6 then begin alguPromo := true; PromosIndex := PromosIndex + 1; Promos[PromosIndex]:= Alumno[index]; end; else begin if Promes[index] > 4 then cantiRecu:= cantiRecu + 1; else begin LibresIndex += 1; Libres[LibresIndex] := Alumno[index]; end; end; end; The compiler marks error in the line 10 of this code (else begin). The error is: Fatal: Syntax error, ; expected but ELSE found. If someone wants to tray compile here is the entire code: http://pastebin.com/dRg1Lguu pascal share|improve this question edited Sep 26 '12 at 14:50 asked Sep 26 '12 at 14:43 sanfilippopablo 4581611 Are you sure that pascal support += operator? –CAMOBAP Sep 26 '12 at 14:44 What is the problem with the code? –BugFinder Sep 26 '12 at 14:46 2 There should not be a semicolon after the end before the else. Ditto for the line cantiRecu:= cantiRecu + 1 - this should not have a semicolon either. –Paul R Sep 26 '12 at 14:47 Thanks man! Was the semicolon! I had a suspect that was that, but i couldn't fix it. Done. Thanks man. –sanfilippopablo Sep 26 '12 at 14:55 @user1491651: OK - I've fleshed this out into a complete answer now - please up-vote and accept it if it has been useful to you. –Paul R Sep 26 '12 at 14:57 add a comment| 2 Answers 2 active oldest votes up vote 5 down vote accepted Note that in Pascal the semicolon is a separator, not a terminator. Sometimes this doesn't matter, but in some
It also takes care of directives and conditional compilation handling. Fatal: Unexpected end of file This typically happens in one of the following cases: The source file ends before the final end. statement. This happens mostly when the begin and end statements are not balanced; An include file ends in the middle of a statement. A comment was not closed. Fatal: String exceeds line There is a missing closing ' in a string, so it occupies multiple lines. Fatal: illegal character "arg1" (arg2) An illegal character was encountered in the input file. Fatal: Syntax error, "arg1" expected but "arg2" found This indicates that the compiler expected http://stackoverflow.com/questions/12604323/whats-wrong-with-this-pascal-syntax a different token than the one you typed. It can occur almost anywhere it is possible to make an error against the Pascal language. Start reading includefile arg1 When you provide the -vt switch, the compiler tells you when it starts reading an included file. Warning: Comment level arg1 found When the -vw switch is used, then the compiler warns you if it finds nested comments. Nested comments are not allowed http://www.freepascal.org/docs-html/user/userse61.html in Turbo Pascal and Delphi, and can be a possible source of errors. Note: Ignored compiler switch "arg1" With -vn on, the compiler warns if it ignores a switch. Warning: Illegal compiler switch "arg1" You included a compiler switch (i.e. {$... }) which the compiler does not recognise. Warning: Misplaced global compiler switch, ignored The compiler switch is misplaced. It must be located at the start of the compilation unit, before the uses clause or any declaration. Error: Illegal char constant This happens when you specify a character with its ASCII code, as in #96, but the number is either illegal, or out of range. Fatal: Cannot open file "arg1" Free Pascal cannot find the program or unit source file you specified on the command line. Fatal: Cannot open include file "arg1" Free Pascal cannot find the source file you specified in a {$include ..} statement. Error: Illegal record alignment specifier "arg1" You are specifying {$PACKRECORDS n} or {$ALIGN n} with an illegal value for n. For $PACKRECORDS valid alignments are 1, 2, 4, 8, 16, 32, C, NORMAL, DEFAULT, and for $ALIGN valid alignments are 1, 2, 4, 8, 16, 32, ON, OFF. Under mode MacPas $ALIGN also supports MAC68K, POWER and RESET. Error: Illegal enum minimum-size specifier "arg1" You are
HCL Search Reviews Search ISOs Go to Page... LinuxQuestions.org > Forums > Non-*NIX Forums > Programming [SOLVED] Syntax error, need some help (pascal) http://www.linuxquestions.org/questions/programming-9/syntax-error-need-some-help-pascal-804959/ User Name Remember Me? Password Programming This forum is for all programming questions. The question does not have to be directly related to Linux and any language is fair game. Notices http://www.tomsguide.com/answers/id-1915809/fixing-pascal-program.html Welcome to LinuxQuestions.org, a friendly and active Linux Community. You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive syntax error our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today! Note that registered members see fewer ads, and ContentLink is completely disabled once you log in. Are you new to LinuxQuestions.org? Visit the following links: Site Howto | Site FAQ | Sitemap | Register fatal syntax error Now If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here. Having a problem logging in? Please visit this page to clear all LQ-related cookies. Introduction to Linux - A Hands on Guide This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter. For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own. Click Here to receive this Complete Guide absolutely free. Search this Thread 04-29-2010, 08:04 AM #1 Asido Member Registered: Jan 2010 Lo
program> Closed i need help fixing this pascal program Tags: Integer Pascal Apps Last response: December 9, 2013 4:56 AM in Apps General Discussion Share shiftyape December 5, 2013 6:06:32 PM program whileloop; var x:integer; answer:string; num:integer; begin num:=12345; writeln('type "12345" if you would like to see nubers squaring up to 4096'); readln(answer); if answer = num then begin writeln('press enter to see the numbers'); readln; end; else begin x:=0; end; x:=1; while x < 4097 do begin writeln(x,' squared is now ',x*x); x:=x+1; end; writeln; readln; end. this is the error i keep getting: whileloop.pas(29,2) Fatal: Syntax error, ";" expected but "ELSE" found and also: whileloop.pas(23,14) Error: Incompatible types: got "LongInt" expected "AnsiString" More about : fixing pascal program ex_bubblehead December 5, 2013 7:16:37 PM So many things wrong here.... And, since this looks suspiciously like a homework assignment, I'm not going to simply hand you the solution. Just for starters: 1. You're looking for equality between a string and an integer 2. You've used ';' in places you shouldn't 3. Your routine has no proper exit, or structure, for that matter. No matter what you choose it falls through and squares the numbers. You have code in there that is better moved into a procedure. Score 0 shiftyape December 5, 2013 8:58:18 PM ex_bubblehead said:So many things wrong here.... And, since this looks suspiciously like a homework assignment, I'm not going to simply hand you the solution. Just for starters: 1. You're looking for equality between a string and an integer 2. You've used ';' in places you shouldn't 3. Your routine has no proper exit, or structure, for that matter. No matter what you choose it falls through and squares the numbers. You have code in there that is better moved into a procedure. oh, wow, ive incited the rage of some random guy. who cares. if you did not come to this post to help, why did you answer at all? by the way this