Transforming one loop in another one

is it theoretically possible to transform any loop into any other loop?
For example: a while loop in a do-while loop or a for-loop in a while loop?
Tnx

YertleTheTurtle wrote:
I don't think you understood my question correctly. I think I did understand your question.
I don't need to write an algorithm to convert one loop in any given other loop. I just need to know if it is possible to change one loop in another by modifying the code.One easy, scientific way to answer an "Is it possible to ..."-style questions is to provide an algorithm that does what is asked for and works in ever case. If such an algorithm exists, then the answer to the question is "Yes, it's possible".
I was trying to direct you to a rather simple (but possibly not ideal) algorithm to do that conversion.
for example:
int example = 5;
do
example++;
while ( example<5 )
First step: convert the loop to an endless loop:
int example = 5;
do {
  example++;
} while (true);Second step: add logic "manually"
int example = 5;
do {
  example++;
  if (!(example < 5)) {
    break;
} while (true);Third step: convert endless do-while loop into any other endless loop you want (left as an exercise for the reader).
Of course this is an easy example but i need to know if it is theoreticaly possible to to this for any given loop into any other given loop.Well, step 1 and step 3 are trivially possible in every case. The only thing you need to make sure is that step 2 is possible in every case. And I personally am pretty sure that it's possible in every case.

Similar Messages

  • Problem with one loop in another one

    When I drag and move cursor, X scale position will be show below. And then I click “add data in array”, the data should be put into array. I can move cursor again to add the second , the third ….into array.
    My problem is:
    In block diagram, once loop2 is outside of loop 1, it works. But I really want loop2 is in loop1 regarding to the rest part of the program. However, we I move loop2 into loop1, when I move cursor, nothing happens.
    Please help to make it work or you have different way to do this job.
    Thank you very much
    Liming
    Attachments:
    yxxx.vi ‏29 KB

    Hey, no need to make it so complicated.  Just add an indicator on the CursLoc.X wire in the  "0 To 5 MHz": Cursor Move  case.
    To answer your questions:
    1) The indicator does not react because you are still within the inner while loop.  It will not change until that loop completes. I.e. the stop button is pressed.
    2) Similarly, the stop 2 button will press, but nothing will happen until the inner loop is done.
    Generally, when I am using an event structure, I try to keep all the changing UI inputs and outputs in the same while loop with the event structure, if not in the event structure itself.  Local variables and property nodes can get the job done, but they are inefficient and can be difficult to debug.  As I am sure you are discovering
    Message Edited by jasonhill on 04-07-2006 12:40 PM
    Attachments:
    cursor position indicator.PNG ‏7 KB

  • About photoshop organizer: how can I shift pictures from one catalogue to another one?

    how can I shift pictures from one catalogue to another one?

    Sync to computer then from there to other device.  Photo stream can be used to sync between devices, but that has to be set up BEFORE the photos are taken.
    Read this...  import photos to your computer...
    http://support.apple.com/kb/HT4083

  • I click on one song and another one starts playing.  Cover art for one artist shows up on another album.  All of my music isn't showing up.  Please help.  Why is this happening?  How can I fix it?

    I click on one song and another one starts playing.  Cover art for one artist shows up on another album.  All of my music isn't showing up.  Please help.  Why is this happening?  How can I fix it?

    Sorry for not getting back with you...
    That moves only the iTunes media, not the iTunes library (which is really kinda nebulous).
    iTunes library = iTunes folder and all the media, wherever it is located.
    The /Music/iTunes/ folder contains the iTunes library.itl file, which keeps track of everything in iTunes.
    I do however still have the original MAIN startup drive still in the computer, it's just not the startup.
    This is good you still have it.
    Try this...
    Hold Option and launch iTunes.
    Select Choose library... and select the /iTunes/ folder on the original drive. It should be in /Users/your_user_name/Music/.
    Don't mess with anything. We can get it cleared up.
    Does everything work okay?

  • Pass data from one VI to another one

    Hi,
    I try to control a event structure in a VI with a boolean command from a second VI. I have been advised to "build a connector to pass any data from one VI to another one".
    Below an simple example: my goal is MyVItwo gives the result of a 2 numbers addition only when the boolean "MyBooléen" value changes in MyVIone.
    How can I realise this?
    Thanks
    PB
    Attachments:
    Example.zip ‏10 KB

    It is not entirely clear what you are trying to do. I think that what you want is a main vi/subvi setup. The boolean control would be in the main vi and would be monitored by an event structure. When the value of the boolean changes the subvi would be activated. I have attached an example showing how this is done.
    In order to use a vi as a subvi you build a connector box. In order to do this you just right click on the vi icon at the top right of the front panel and select show connector. You then wire connections on the connector block to controls on the front panel. You insert the subvi into your main vi by choosing "Select a vi" on the functions pallette and browsing to the subvi.
    If you absolutely have to pass the data from one vi to another while running in parallel there are a number of ways to do it. Global variables will certainly work but are generally avoided by experienced LabVIEW programmers due to their potential caveats and the break in data flow. An alternative to global variables is the functional global, also called a LV2 style global. This is basically a non-reentrant subvi with an unitialized shift register which allows for data to be stored. For more information search this forum for LV2 globals.
    Another alternative is to obtain a reference to the control and operate on that reference. You could also use queues, notifiers, or occurences. Search the examples which shipped with LabVIEW for examples on using these operators.
    If you need any more information feel free to post back here.

  • Is it possible to set table-variant from one user to another one?

    Is it possible to set table-variants from a t-code like fb60 from one user to another one?
    I mean that both user have the same table-variants.

    You mean screen variant, where you will need to anter the GL line items in FB50?
    then you can set your desired variant as DEFAULT for all users, when it is configured.
    Else thru SU10, for all of your users, add parameter ID SCRVAR and give your parameter value (screen variant name) and SAVE.

  • Overlay one image over another one.

    Hi,
    I am trying to overlay one image over another one.
    (example ..
    First images 1) This will have complete picture like the passport picture with background
    Second Image 2) This will have some specific parts(background of above) whitened
    Result picture 3) This should have the passport picture with out any background just the person.
    Is this possible using intermedia ??
    Thanks in advance.

    dude, not too sure the dept. of homeland security is going to be cool with doing that.
    unless you can make me a passport from Guam.

  • Passing ctlRef from one loop to another

    Is it possible to pass ctrlRef from one While loop to another??  I want to have the value of  crtlRef of an evet case in a while loop in another while loop. See the attachment.
    Any way to do it?
    Nghtcwrlr
    ********************Kudos are alwayzz Welcome !! ******************
    Attachments:
    Ques1.JPG ‏75 KB

    How is it that actually? When i connect the CtlRef to parameter input of QMH Add Message to Queue.vi, it shows connecting different types. Couly you please give me a tip?
    Nghtcwrlr
    ********************Kudos are alwayzz Welcome !! ******************

  • How can I move data from one loop to another?

    I am using LabVIEW to record and display data.  The problem that I have run into is that if I try to collect and display the data all in one loop data points are lost because the loop takes so long to execute.  I decided to break my program into two independent loops and the data is recorded at proper speeds, but now I cannot get the data out of the first loop and into the second loop.

    See my example for one method of how to setup the Queue which Omar suggested. You'll also see many other ways, most of which should be avoided until you get more experience.
    Communicating Between Loops
    Richard

  • Transfer money from one account to another one

    Hi all
    I am using EBS 11i, and i have the following modules: General Ledger, Account Payables and Cash Management.
    I have different bank accounts in the system and now we want to transfer money from one bank account to another one.
    How should i do this in the system. What type of document should i register to reflect this transfer. I know that it can be done by registering a journal with a clearing account and then reconcile this journal to the cash management module.
    My question is: Is possible to register in the payables module this kind of transactions. Can i solve this by registering payments in this module. On payment the supplier is mandatory, but i do not have any supplier in this case. I have a payment from a specific bank account and then a refund to the other bank account but not involving any specific supplier.
    Please advice if you have any suggestions.
    Thank you all and best regards

    Hi Ernest,
    This is what you can do.
    1) Whenever there are bank transfers, there is Cash-In in one account and Cash-Out from another account.
    2) When you enter the bank statements for these bank accounts, associate the transaction type codes of Misc Receipt and Misc Payment to these statements. Setup the bank transaction codes so that when you perform AutoReconciliation, the system creates Misc Receipts in AR for these statement lines. (You associate a Receivables activity with the transaction code).
    3) When you will run AutoRec, the Misc Receipt is created for the Bank account where funds are received and the Misc Receipt (with negative amount) which is equivalent to a Misc Payment is created for the Bank Account from where funds are transferred. The offset to the bank account is the clearing account in both entries which becomes zero at the end.
    4) With this workaround, there is no need to setup Dummy Supplier or run any payment process in AP.
    Hope this helps.
    Thanks,
    Anil

  • HT1296 How do I transfer data from one ipad to another one?

    I have the orginal ipad and my husband bought me the retina one this weekend. I need to transfer the data on it to the new one.
    Also how do I transfer the ownershlip of one to another as we were going to give one of the older ones we have to my granddaughter to
    play games on and use?

    Look at this link.
    Giving your former iPad to a spouse or family member: the quick guide
    http://www.tuaw.com/2012/03/17/giving-your-former-ipad-to-a-spouse-or-family-mem ber-the-quick/
     Cheers, Tom

  • How to transfer songs from one iPOD to another one?

    On my old iPOD I've collected songs for various libraries (from friends and my two computers) but stupid iTUNES won't let me transfer my songs from this iPOD back to Library.
    So, now when I've got a new a iPOD, I have to put all the songs there again, because iTUNES again won't let me transfer songs from one iPOD to another iPOD, when both are connected to the same computer!!
    What should I do?
    Apple as an innovator company should come up with an update to solve this easy issue.
      Windows XP Pro  

    Haven't you got your songs in iTunes? Just connect your new one and it will update from your Library.
    However if you have deleted them from the PC, there are a number of third party utilities that can retrieve the files from your iPod.
    YamiPod: http://www.yamipod.com/
    PodUtil: http://www.kennettnet.co.uk/software/podutil.php
    PodPlayer: http://www.ipodsoft.com/software.aspx

  • What are the methods called while navigating from one applet to another one

    Hi All,
    Could any one brief me about "When you navigate from one applet to another what are the methods called ?".
    Thanks in advance.
    Best Regards,
    N.Madhusudhanan.

    http://forum.java.sun.com/thread.jsp?forum=421&thread=426771&tstart=0&trange=100

  • How do I copy a photo from one folder to another one in Aperture

    I'm old and feeble      I cannot figure out how to copy a photo from one folder to another folder   and my 13 year old grandson can't figure it out either, so I feel better about it
    thanks
    canonmick

    Um ... that doesn't seem ... like a useful workflow.  When you say "folder" do you mean a Folder in Aperture (shown on the Library tab of the Inspector) or a folder in Finder?  They are not at all the same thing.
    Aperture is an image manager, with the requisite file management built-in.  Finder is a file manager.
    If you provide a full description of what are doing, and what you are trying to do, someone here can set your straight.
    Fwiw, IME, the learning curve if very long and uphill, but gentle.  What's unusual (esp. for Apple products) is that the landmass of Aperture is separated from the rest of your computer knowledge by a moat.  What I mean is, the first leap is the hardest.  After that, you'll be on firm ground, ready to explore.

  • How to transfer an iphone's libraries from one pc to another one?

    Hi all,
    I used to synch my 3gs iphone using my laptop (xp window). However, this laptop currently had started having problem with its hard drive so I decided to use another laptop (window 7) for synching my iphone in the future.
    I really do not want to re-create its libraries from scratch. So how can I transfer its libraries from the old laptop to the new one and get they synched with my iphone just like they are with the old laptop? Your help will be great appreciated. Thanks in advance.

    http://support.apple.com/kb/HT1751

Maybe you are looking for