Post: For Loop Tutorial
08-24-2012, 09:58 AM #1
(adsbygoogle = window.adsbygoogle || []).push({}); Well, I'm going to tell what a for loop is
If you don't get these then go ahead and leave this thread.
I'm not going to explain what everything does in each function.
    
//Will run infinate times until death
function()
{
self endon("death");
for(;Winky Winky
{
self iPrintln("LOL Infinate");
wait 1;
}
}


    
//Will run 10 times
function()
{
self endon("death");
for(i = 0;i < 10;i++)
{
self iPrintln("LOL 10 Times");
wait 1;
}
}


    
//Will run 20 times
function()
{
self endon("death");
for(i = 0;i < 20;i++)
{
self iPrintln("LOL 20 Times");
wait 1;
}
}


If you want a message to pop after the LOL ect.

    
//Will run 15 times with a end message
function()
{
self endon("death");
for(i = 0;i < 15;i++)
{
self iPrinln("LOL 15 Times");
wait 1;
}
self iPrintln("A new message");
}
(adsbygoogle = window.adsbygoogle || []).push({});

The following 8 users say thank you to TheUnexpected for this useful post:

ConnorModz, Host4U_PS3, I-LOVE-Coockies, KingcreekS, LightModz, JokerRey, ThePhantom410., xMr_Adams-
08-24-2012, 01:44 PM #2
LightModz
League Champion
Originally posted by TheUnexpected View Post
Well, I'm going to tell what a for loop is
If you don't get these then go ahead and leave this thread.
I'm not going to explain what everything does in each function.
    
//Will run infinate times until death
function()
{
self endon("death");
for(;Winky Winky
{
self iPrintln("LOL Infinate");
}
}


    
//Will run 10 times
function()
{
self endon("death");
for(i = 0;i < 10;i++)
{
self iPrintln("LOL 10 Times");
}
}


    
//Will run 20 times
function()
{
self endon("death");
for(i = 0;i < 20;i++)
{
self iPrintln("LOL 20 Times");
}
}


If you want a message to pop after the LOL ect.

    
//Will run 15 times with a end message
function()
{
self endon("death");
for(i = 0;i < 15;i++)
{
self iPrinln("LOL 15 Times");
wait 1;
}
self iPrintln("A new message");
}

or you can just use for(;Winky Winky and it will turn unlimited times
example
    example(){for(;Winky Winky{iprintlnbold("test");}}

The following user thanked LightModz for this useful post:

xMr_Adams-
08-24-2012, 02:43 PM #3
247Yamato
< ^ > < ^ >
Terrible laggs with some of those codes :carling:

The following 6 users say thank you to 247Yamato for this useful post:

aerosoul94, ConnorModz, KingcreekS, Kitty=^.^=, TheFallen
08-24-2012, 02:50 PM #4
xMr_Adams-
Do a barrel roll!
Nicee Post
+Rep ^^
08-24-2012, 03:00 PM #5
Originally posted by LightModz View Post
or you can just use for(;Winky Winky and it will turn unlimited times
example
    example(){for(;Winky Winky{iprintlnbold("test");}}


I said that lol
08-24-2012, 10:10 PM #6
TheFallen
Former Dark Night
Originally posted by TheUnexpected View Post
Well, I'm going to tell what a for loop is
If you don't get these then go ahead and leave this thread.
I'm not going to explain what everything does in each function.
    
//Will run infinate times until death
function()
{
self endon("death");
for(;Winky Winky
{
self iPrintln("LOL Infinate");
}
}


    
//Will run 10 times
function()
{
self endon("death");
for(i = 0;i < 10;i++)
{
self iPrintln("LOL 10 Times");
}
}


    
//Will run 20 times
function()
{
self endon("death");
for(i = 0;i < 20;i++)
{
self iPrintln("LOL 20 Times");
}
}


If you want a message to pop after the LOL ect.

    
//Will run 15 times with a end message
function()
{
self endon("death");
for(i = 0;i < 15;i++)
{
self iPrinln("LOL 15 Times");
wait 1;
}
self iPrintln("A new message");
}

    
for(starting value;condition;action)



Basically "for(;Winky Winky" creates and defines the variable "starting value" and does the "action" until the "condition" is no longer true (false).

The following 2 users say thank you to TheFallen for this useful post:

ConnorModz, KingcreekS
08-24-2012, 10:45 PM #7
Cmd-X
It's been awhile.
Originally posted by Master
    
for(starting value;condition;action)



Basically "for(;Winky Winky" creates and defines the variable <starting value> and does <action> until <condition> is no longer true (false).



Originally posted by TheUnexpected View Post
//Will run 15 times with a end message function() { self endon("death"); for(i = 0;i < 15;i++) { self iPrinln("LOL 15 Times"); wait 1; } self iPrintln("A new message"); }


that would run 14 times, since it's less than 15.
08-24-2012, 10:50 PM #8
TheFallen
Former Dark Night
Originally posted by X View Post
that would run 14 times, since it's less than 15.

No it would run 15 times, i = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14} :p

The following 3 users say thank you to TheFallen for this useful post:

ConnorModz, I-LOVE-Coockies,
08-24-2012, 11:06 PM #9
Cmd-X
It's been awhile.
Originally posted by Master
No it would run 15 times, i = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14} :p


are you sure? 'cause this one script I made, I made it so i was less than 11, and it only went up to ten.. So yeah :/
08-24-2012, 11:08 PM #10
IVI40A3Fusionz
Former Gaming Squad Member
Even better idea read KBrizzles GSC Tut and you'll get this and much more! :O!

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo