Terms of Agreement:
By using this article, you agree to the following terms...
You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
You may link to this article from another website, but ONLY if it is not wrapped in a frame.
You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
aren't you always going to be stuck in this loop because you are constantly reseting the value of $x to 0 ?? (If this comment was disrespectful, please report it.)
No Travis, because you're saying that ("X will start at 0, do the task and add one to X. Keep doing that until X=99 or 100") (If this comment was disrespectful, please report it.)
The construct is not complete without the closing brace, and Brandon, it finishes when $x is greater than 100. (If this comment was disrespectful, please report it.)
LOL @ your comment Joseph! the loop will run! have u ever coded in perl? if not just run this perl progie: #!/usr/bin/perl for($x=0;$x<=100;$x++){ print "\n$x"; } by doing this u will c that the loop stops when $x = 100, it is a shame having ppl who don't even know what they r saying posting comments, plz go learn b4 saying anything (the code will print 101 lines each line contains a # from 0 to 100). Bleh. Laterz (If this comment was disrespectful, please report it.)
Technically Bruno the loop stops when $x equals 101. The post incremental operator ($x++) increments $x after execution of code contained within loop and then the loop test ($x<=100) returns false i.e $x is NOT less than or equal to 100, thus ending the looping process. I thought this was a forum for helping ppl not flaming them - I think you need to read what YOU wrote as YOUR loop test! HTH (If this comment was disrespectful, please report it.)
I just get pissed when i c ppl who don't even know what they r saying posting comments saying something is wrong, i wrote this code in the momment i saw the post about that guy answering to yer other post. I didn't even test it it is just obvious what he code would do. Laterz (If this comment was disrespectful, please report it.)
LOL, this stuff is funny, i thought this was a place for coders, but i see also humorists are welcome. By the way, $x starts at 0, then it checks if $x is below or equal to 100, then adds 1. Since it is is a for loop it won't continue executing the code inside the loop when $x is greater then 100, it will however add 1 to $x AFTER the the max is reached, so it will come to a total of 101, not loops, but $x. if you dont understand, check it with the following code:
#! /usr/bin/perl -w
for ($x = 0; $x <= 100; $x++ ) {
print (If this comment was disrespectful, please report it.)
Yah, this code is ignorant. Anbody who knows Perl knows how to do a simple loop such as this one...ugh! Post something worth reading and viewing ;-) Oh, btw, check out my site Synthesize VB. We have alot of VB stuff but the whole site is based off Perl so if you wanna see a website with some Perl action, then scope this site. Thanx (If this comment was disrespectful, please report it.)
Hey James! I didn't know that you were a member here! Please, everyone, check out our site!!! It is Perl-based, like James said. I did most of it, but I am letting James do a bit here and there. It is a good start, but we need to get all of the pages up! Bye! (If this comment was disrespectful, please report it.)
I think what confuses most programmers is the fact it says ;$x<=100; when you are thinking in your head "when $x>=100 then stop". The logic of the "for" loop is actually "so long as $x<=100, then keep going". The fact the author forget his ending } is irrelevent since you know to do this anyway. (If this comment was disrespectful, please report it.)
i thought i was gonna find a big tutorial... i found an incomplete for loop :) (If this comment was disrespectful, please report it.)
Add Your Feedback
Your feedback will be posted below and an email sent to
the author. Please remember that the author was kind enough to
share this with you, so any criticisms must be stated politely, or they
will be deleted. (For feedback not related to this particular article, please
click here instead.)