query to run this function

sriram05in's Avatar, Join Date: Jul 2010
Newbie Member
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.
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
0
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
> 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).

http://www.csharphelp.com/forum/topi...is-programming

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?