Author Topic: Doing stuff that is very powerful, and very easy (for i)  (Read 2523 times)

Offline formula1

  • Almost Regular
  • ***
  • Posts: 243
Doing stuff that is very powerful, and very easy (for i)
« on: July 18, 2009, 01:53:10 PM »
Something I'm going to teach is a loop

Loops are probably one of the few things I've learned in programming that is particularly interesting besides creating your own methods and structures

in many programming languages (including Java script) there is a looping Mechanism (I don't care about the real names) that allows you to loop a number of times while also having a variable

For example
(lulz.... For...)

For a = 0 to 99
System.out.println("a is equal to " + a)

If you want to try it out on Java script (since that is going to be one of the few places you will be able to try it out without downloading an extremely unhappilly large programming environment)

Try this

<div id="panel">
<script type="text/javascript">
var i;
for(i=1; i<20;i++){
document.write("a is equal to " + i + "<br>");

To do this with some arrays
var arrayz = [];
arrayz[0] = stuff;
arrayz[2] = moar stuff;
arrayz[1] = less stuff;

then make...
for(i=0; i<2; i++){

Try it.... it might work :O

Example of my java Script Playground
I want the wisest things to happen
If you like stuff. That stuff will always exsist.... IN YOUR MIND! OH SHNAP! UNLESS U FORGETZ IT! OR SHNAP! maybe...
Destryers Inc