HOME | DD

FullHitPoints — Programming Basics : The FOR Statement

#programming #tutorial #walfas #fullhitpoints #fullhp #walfasstationwagon
Published: 2015-10-17 09:30:54 +0000 UTC; Views: 1172; Favourites: 7; Downloads: 4
Redirect to original
Description This was inspired by an attempt at tutoring programming earlier. MichiharuRuko was having difficulty understanding how FOR statements worked, so I decided to make this simple guide breaking down exactly how it operates in a clear, concise, easy-to-understand manner. Let me know if this understandable enough without being too complicated.

Prop credits
Flipped Table by LikeThisRLYMatters
Hands by Ceej39
Related content
Comments: 13

Feraligono [2015-10-21 12:14:13 +0000 UTC]

for(c=0; c > java; c++){
     cout << "lol";
}

👍: 0 ⏩: 1

FullHitPoints In reply to Feraligono [2015-10-22 18:27:52 +0000 UTC]

if (unending_for == 1) {
      while (shocked == 1) {
         cout << "Oh dear God, what have you done?";
      }
}
   

👍: 0 ⏩: 0

Bluyidark [2015-10-18 13:35:21 +0000 UTC]

Though I'm not involved in any kind of programming, I would say this is a brief and good guide, which makes the content more understandable.

The only programming-related thing I learned is about HTML (I don't know whether this counts XP), and I almost forgot how to access it already. TT_TT (except in DA XD)

👍: 0 ⏩: 1

FullHitPoints In reply to Bluyidark [2015-10-18 22:02:45 +0000 UTC]

HTML certainly counts! It's a programming language understood by web browsers. I'm not sure if it uses a FOR statement, as I've only dabbled in it a tiny amount, but it certainly counts as a programming language.

👍: 0 ⏩: 1

popfan95b In reply to FullHitPoints [2015-10-23 12:14:11 +0000 UTC]

While HTML doesn't have a for statement, PHP is also used in website construction, and it has it. I've actually used it for displaying the dates and events on TGA's website in an efficient manner:

switch ($_SESSION['lang']) {
    case 0:
        echo $history_en;
        include 'templates/events_en.php';   
        break;
    case 1:
        echo $history_jp;
        include 'templates/events_jp.php';   
        break;
}
echo "

";
for ($i=count($news)-1; $i>=0; $i--) {
    echo "
       
           
           
       
    ";
}
echo "
".$news[$i][0]."".$news[$i][1]."
";

Basically, it includes one of two PHP files that store the dates and corresponding events in a two-dimensional array, depending on the current language setting of the website. The for statement sets $i to the latest entry and then decrements itself after each loop. Said loop involves writing HTML code for a table line, meaning I don't have to manually increase the size of the table every time a new event gets added. All I have to do is add that new event to the events_en.php and events_jp.php and the above code takes care of the rest.

Also, HTML is generally considered a markup language. It doesn't really have variables or much in terms of what defines a programming language. Instead it uses tags to let you display text and images in a certain way. There is a reason web designers usually use PHP, CSS* and Javascript in conjunction with HTML. That said, HTML is still a kind of code that you feed into a compiler (i.e. the web browser), which then displays the result, so I can see why people would consider it a programming language.

*CSS itself is a style sheet language, rather than a programming language. It basically augments HTML's website presentation capabilities.

👍: 0 ⏩: 0

bigattck [2015-10-17 17:42:00 +0000 UTC]

if no_langrage_explain:
ask = "what language is this, it's not python or C#"

else:
ask = "This is madness."

👍: 0 ⏩: 1

FullHitPoints In reply to bigattck [2015-10-17 19:40:45 +0000 UTC]

See here.

👍: 0 ⏩: 0

Orangecraz [2015-10-17 17:31:11 +0000 UTC]

You forgot to declare the variables. Like so:

int direction; //Declare that the variable direction is an integer. It will only take integers.
for(int i = 0; i <3; i++){
      direction = 80 + 10 * i;
}

Other than that, it's spot on.

COMPUTER SCIENCE MUDDUF***AS!!

👍: 0 ⏩: 1

FullHitPoints In reply to Orangecraz [2015-10-17 18:36:50 +0000 UTC]

Well, the syntax can vary slightly depending on the language, and I'm trying to keep it a bit general. Of course, this was specifically made for a friend of mine to help them understand how the FOR statement works, so keeping it simple is probably for the best. We were specifically working with GML (Which is more-or-less based off C), and this would've been perfectly acceptable syntax, because that language declares a variable the first time you write variable=70 or the like.

I'll probably talk a bit about variables in the next one if I make one.

👍: 0 ⏩: 1

Orangecraz In reply to FullHitPoints [2015-10-17 19:00:23 +0000 UTC]

Ok. Just making sure you knew.

👍: 0 ⏩: 0

Noraneko-Sparks [2015-10-17 14:20:41 +0000 UTC]

FOR

WHAT IS IT GOOD FOR!?

Looping all the things.  Loop, loop, loop, loopy, loop-y, loopy, loopy, loopy, loop!

Of course, syntax may vary but the idea is to iterate a single set of instructions a certain amount of time before Yuki flips a table and storms out.  XD  Now I'm imagining you in your cosplay, doing that.  XD

👍: 0 ⏩: 1

FullHitPoints In reply to Noraneko-Sparks [2015-10-17 23:08:40 +0000 UTC]

I didn't know you were into programming, Nora!

👍: 0 ⏩: 1

Noraneko-Sparks In reply to FullHitPoints [2015-10-18 01:02:14 +0000 UTC]

Software Engineering major

👍: 0 ⏩: 0