Solved

about while loop and case

Posted on 1998-10-28
9
324 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
 
LVL 7

Expert Comment

by:Inteqam
ID: 1215887
To lewis_loo:

Can you explain more?


0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

HOW TO: Install and Configure VMware vSphere Hypervisor 6.5 (ESXi 6.5), Step by Step Tutorial with screenshots. From Download, Checking Media, to Completed Installation.
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now