Solved

about while loop and case

Posted on 1998-10-28
9
341 Views
Last Modified: 2010-04-16
How can I change the case statement in the while loop looping?
can you show me the source code for this question?
0
Comment
Question by:lewis_loo
9 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1215884
hi lewis_loo

Why this

that are two different things

meikl
0
 
LVL 2

Expert Comment

by:omsec
ID: 1215885
think you mean :

while Something <> True then
  begin
    case ThisVar of
      ...
  end
else // "Something" is now True
  begin
    case ThatVar of
      ...
  end;

not sure if you mean that
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1215886
hi omsec

something is wrong in your example. Where come the else. In while ..do there can no else in the case there can be a else but then something <> true.

meikl
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 7

Expert Comment

by:Inteqam
ID: 1215887
To lewis_loo:

Can you explain more?


0
 
LVL 2

Expert Comment

by:omsec
ID: 1215888
i see, i didnt check the Syntax. I also never used While and Else
together, i thought WHILE "something" is true do the case block,
Else (after) do the other, the else-bleck

while Something <> True then
  begin
    case ThisVar of
      ...
    end; { of case}
  end
else // "Something" is now True
  begin
    case ThatVar of
      ...
    end; {of case}
  end;

.but never done it this way

0
 
LVL 1

Expert Comment

by:saam
ID: 1215889
strange question... more info please
0
 
LVL 1

Expert Comment

by:FuzzyLogic
ID: 1215890
If you mean that the case switches are changed every time (for example according to some input string), while the while loop continue, this is not possible. You should use a bunch of "if" statements.
Anyway, too long thread for a two points question...
0
 
LVL 3

Expert Comment

by:vikiing
ID: 1215891
The question is not clear enough, Lewis. Give an example of what you need, or specify a bit more.
0
 
LVL 3

Accepted Solution

by:
daitt earned 0 total points
ID: 1215892
I guess you want to change a case statement's constants (and maybe the switch) within a while statement. There's only one way to do this (as far as I know), and it's not easy at all. You have to have Assmbler knowledges, compiler knowledges to do this.
Just decode your program (using Debug or Sourcer is up to you), then look at the code generated by the compiler. You'll see the positions of the constant, the code to compare the switch to the constants and ranges... everything there. Write down the offset of these things. Then you can return to your Pascal program, append the modifying code after the case statement (to write the value needed into memory at constants's position).
These things above is just for understanding Pascal compiler and enhance you knowlegde of Machine Language. If you have no experience in these, don't touch your exe file. A good way is to use IF statement instead of CASE statement. IF statement can be change anytime you want.
Anyway, it's too much for your two points.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi & Indy 10 Whois over Web Proxy 3 1,213
WebCam and Delphi 2 2,686
qrdesign delphi 5 pdf 5 462
Lazarus: saving BLOBs from Sybase database 3 159
This article describes how to reset your Windows 10 password when you've forgotten it.
The advancement in technology has been a great source of betterment and empowerment for the human race, Nevertheless, this is not to say that technology doesn’t have any problems. We are bombarded with constant distractions, whether as an overload o…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question