1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

query to run this function

Discussion in 'C' started by sriram05in, Jul 1, 2010.

  1. sriram05in

    sriram05in New Member

    Joined:
    Jul 1, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    I have created a programme to run a function. This program will run for 10 times. My question is I want system to run the program less than 10 times ( for example 6 times) and stop immediately . I do not want to change the condition in while statement. Please guide me.
    Code:
    namespace Tekla.Technology.Akit.UserScript
    {
    public class Script
    {
    public static void Run(Tekla.Technology.Akit.IScript akit)
    {
    int a;
    a=1;
    while ( a < 10 )
    {
    akit.Callback("acmd_update_marks_all", "", "main_frame");
    akit.Callback("acmdRemoveAllMarkChangeSymbols", "", "main_frame");
    akit.Callback("grOpenNextDrawingCB", "", "main_frame");
    akit.PushButton("gr_open_save_dr_editor_yes", "gr_open_drawing_confirm_instance");
    a=a+1;
    }
    }
    }
    }
    please send your reply to sriram05in@yahoo.co.in
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    > please send your reply to

    Sorry, that doesn't work here. You post here, you read your answer here.

    > Posts: 1

    Ah, I see. At a guess you're just spamming all the programming forums you can find with the same question and hoping we'll just drop the answer directly into your inbox. Good luck with that. Most people can see through such laziness (and in fact most don't bother replying to such a timewaster).

    OK, only one other. That's not bad; I've seen posts to a lot more than that in the past.

    Well, anyway, I do have an actually useful comment to make. If you can't change the while, is there something else you can change to make the loop only execute 6 times? What if a isn't initialised to 1, for example? But why wouldn't you want to change the while; this obfuscates the code, and a isn't used in the loop so the values don't really matter; it's just a mechanism for repeating the loop contents the required number of times. Is this an academic exercise?
     

Share This Page