Error Ordinal Expression Expected
Contents |
Mailing List Lazarus Website Downloads (Laz+FPC) FAQ Wiki Bugtracker IRC channel Developer types of errors in pascal programming Blog Follow us on Twitter Latest SVN Mailing type checking error List Other languages Foundation Website Useful Wiki Links Project Roadmap Getting
Operator Is Not Overloaded Pascal
the Source Screenshots About donations (wiki) Bookstore Computer Math and Games in Pascal Lazarus, the complete guide (only a few left) Search Advanced search « previous next
Identifier Expected Pascal
» Print Pages: [1] Author Topic: Case help. Ordinal expression expected. Constant and CASE types do not match (Read 8936 times) pashbrown New member Posts: 25 Case help. Ordinal expression expected. Constant and CASE types do not match « on: September 21, 2012, 01:10:04 am » if (calculation[k]='+') or (calculation[k]='-') or (calculation[k]='*') or (calculation[k]='/') then which of the following is optional when writing a function definition? begin op:=calculation[k]; case op of '+' : answer:=(whichnum)+(whichnum[x-1]); '-' : answer:=(whichnum)-(whichnum[x-1]); '*' : answer:=(whichnum)*(whichnum[x-1]); '/' : answer:=(whichnum)/(whichnum[x-1]); end; This is my case, calculation is a string, k is an integer, op is a string, answer is an integer, whichnum is an array of integers, x in an integer.I get the errors 'Ordinal expression expected' and 'Constant and CASE types do not match'wat do Logged Cruseâ„¢ Powered pashbrown New member Posts: 25 Re: Case help. Ordinal expression expected. Constant and CASE types do not match « Reply #1 on: September 21, 2012, 01:12:58 am » Well something went wrong there if (calculation[k]='+') or (calculation[k]='-') or (calculation[k]='*') or (calculation[k]='/') then begin op:=calculation[k]; case op of '+' : answer:=(whichnum[x ])+(whichnum[x-1]); '-' : answer:=(whichnum[x ])-(whichnum[x-1]); '*' : answer:=(whichnum[x ])*(whichnum[x-1]); '/' : answer:=(whichnum[x ])/(whichnum[x-1]); end
I get Error 39: Ordinal expression expected. I am trying to use a array of 50 words. Any help would be appreicated. Procedure Double(Var Words:WordArray); Var LCV, Pos:Integer; Begin For LCV := 1 to 50 Do For Pos := 1 to Words[LCV] Do
If Statement Pascal
If Words[LCV][Pos] = Words[LCV][Pos] Then Writeln(Words[LCV]); ReadKey End; Regards, pascal if Michael Michael Taylo Delphi Developer Wed, 18 Jun 1902 08:00:00 GMT Re:Ordinal expression expected Please help, in procedure Double the words that have double letters case pascal should printed but I get Error 39: Ordinal expression expected. I am trying to use a array of 50 words. Any help would be appreicated. Procedure Double(Var Words:WordArray); Var LCV, Pos:Integer; Begin For LCV := 1 to 50 Do http://forum.lazarus.freepascal.org/index.php?topic=18292.0 For Pos := 1 to Words[LCV] Do If Words[LCV][Pos] = Words[LCV][Pos] Then Writeln(Words[LCV]); ReadKey End; Regards, Michael Michael Taylo Delphi Developer Wed, 18 Jun 1902 08:00:00 GMT Re:Ordinal expression expected Please help, in procedure Double the words that have double letters should printed but I get Error 39: Ordinal expression expected. I am trying to use a array of 50 words. Any help would be appreicated. Procedure Double(Var Words:WordArray); Var LCV, Pos:Integer; Begin http://www.delphigroups.info/2/2f/16783.html For LCV := 1 to 50 Do For Pos := 1 to Words[LCV] Do If Words[LCV][Pos] = Words[LCV][Pos] Then Writeln(Words[LCV]); ReadKey End; Regards, Michael Scott Earnes Delphi Developer Wed, 18 Jun 1902 08:00:00 GMT Re:Ordinal expression expected QuoteMichael Taylor wrote: > Please help, in procedure Double the words that have double letters should > printed but I get Error 39: Ordinal expression expected. I am trying to use > a array of 50 words. Any help would be appreicated. > Procedure Double(Var Words:WordArray); > Var LCV, Pos:Integer; > Begin > For LCV := 1 to 50 Do > For Pos := 1 to Words[LCV] Do > If Words[LCV][Pos] = Words[LCV][Pos] Problem #1 to consider: This will always evaluate to TRUE, because you're telling it to compare the same variable with itself. Quote> Then Writeln(Words[LCV]); What's your type declaration of WordArray? If it's a two-dimensional array, then Words[LCV] refers to a single-dimension array within the large array. Of course, arrays aren't ordinal types, so you'd get this message. You may need to reconsider your approach to the problem, and think harder about what you're trying to do. Also, when you need help trying to understand, make sure you post ALL the relevant information. You neglected to show how WordArray is defined, and you also don't say where exactly your error occurred. Quote> Read
Categories 141.8K All Categories104.8K Programming Languages 6.4K Assembler Developer 1.9K Basic 39.9K C and C++ 4.3K C# 7.9K Delphi and Kylix http://www.programmersheaven.com/discussion/390522/ordinal-expression-expected 4 Haskell 9.6K Java 4.1K Pascal 1.3K Perl 2K PHP 525 Python 37 Ruby 4.4K VB.NET 1.6K VBA 20.8K Visual Basic 2.6K Game programming 312 Console programming 89 DirectX Game dev 1 Minecraft 110 Newbie Game Programmers 2 Oculus Rift 9K Applications 1.8K Computer Graphics 732 Computer Hardware 3.5K Database & SQL 528 Electronics development 1.6K Matlab error ordinal 628 Sound & Music 257 XML Development 3.3K Classifieds 198 Co-operative Projects 189 For sale 190 FreeLance Software City 1.9K Jobs Available 601 Jobs Wanted 202 Wanted 2.9K Microsoft .NET 1.7K ASP.NET 1.1K .NET General 3.3K Miscellaneous 5 Join the Team 0 User Profiles 354 Comments on this site 62 Computer Emulators 2.1K General programming 187 New programming error ordinal expression languages 613 Off topic board 179 Mobile & Wireless 53 Android 124 Palm Pilot 335 Multimedia 151 Demo programming 184 MP3 programming 6.9K Operating Systems & Platforms 0 Bash scripts 22 Cloud Computing 365 Embedded / RTOS 53 FreeBSD 1.7K LINUX programming 369 MS-DOS 0 Shell scripting 320 Windows CE & Pocket PC 4.1K Windows programming 906 Software Development 408 Algorithms 68 Object Orientation 89 Project Management 90 Quality & Testing 250 Security 7.6K WEB-Development 1.8K Active Server Pages 61 AJAX 2 Bootstrap Themes 55 CGI Development 19 ColdFusion 224 Flash development 1.4K HTML & WEB-Design 1.4K Internet Development 2.2K JavaScript 35 JQuery 290 WEB Servers 153 WEB-Services / SOAP Ordinal expression expected? Meroosh Member Posts: 3 May 2009 in Pascal Hey.So, here is a part of a program...The compiler gave me an "Ordinal expression expected" error for the command hilighted in blue.Type mismatch for the command hilighted in red?...(I then tried to change the variable to int and it disappeared, but didn't do what was needed - decimel calculations).[code]VARTIncome,TIncome2,TIncome3,TIncome4,TIncome5,TIncome6:real;KNum:integer;BEGINwriteln('Please enter your