Teen Programmers Unite  
 

 

Return to forum top

count

Posted by JACKsprat [send private reply] at January 06, 2002, 05:19:51 PM

hi all,

i was wondering does this increase or decrease a variable after/during each pass say if its used in a loop?

my first post.

Posted by CodeRed [send private reply] at January 06, 2002, 05:40:29 PM

you mean variable++ or ++variable right? In a for loop i think the variable is always modified after the loop, but with var++ it happens after assignment, ++var before assignment.

Posted by taubz [send private reply] at January 06, 2002, 06:31:00 PM

Jack, what language are you using? To me your question isn't clear from your post.

- taubz

Posted by JACKsprat [send private reply] at January 07, 2002, 09:35:07 PM

Oh sorry taubz I am learning c++.

Posted by Psion [send private reply] at January 07, 2002, 09:41:13 PM

That doesn't change the fact that "count" still has no set meaning in that context.

Posted by DakeDesuDx [send private reply] at January 08, 2002, 05:30:59 PM

AH-HA! I just remembered my (quasi) witty comment support telling us which langauage!

<wit class="really-weak">
It could be for(int i = 0; <condition>; i++) or

100 REM *** Dumb Loop ***
110 let j = 0
120 for j < 10
130 next j

(this is really digging into my mind for these rusty BASIC skills, so there will most likely be something wrong there). It all depends on your langauge. It could be (if your dealing with an array:)

foreach @array as $scalar {
# increment which one, automatically.
}

It could be anything if you do not specify a langauge.
</wit>

Posted by CodeRed [send private reply] at January 08, 2002, 07:02:10 PM

he means count++, and like I said it increments the variable AFTER loop/assignment.

Ex.

sum = var1++ + var2; //where var1 and var2 = 5
//after execution sum = 10, var1 = 6, and var2 = 5

sum = ++var1 + var2; //where var1 and var2 = 5
//after execution sum = 11, var1 = 6, and var2 = 5;

Posted by DakeDesuDx [send private reply] at January 08, 2002, 07:14:32 PM

Well, besides the point that incrementing and decrementing are basic syntax in ANY langauge, what was going on here CodeRed, was they were talking about the topic. If you read those funny letters grouped together at the beginning of the forum, it says to have a topic other than "need help" and also to specify the langauge.

Posted by taubz [send private reply] at January 09, 2002, 08:34:03 AM

I added to specify a language in response to this post!

Posted by DakeDesuDx [send private reply] at January 09, 2002, 03:57:52 PM

LOL!!!!!

How old is this post? I am pretty sure I saw that "Specify Language" when I first start to use this forum.

Posted by CodeRed [send private reply] at January 09, 2002, 07:50:33 PM

"...what was going on here CodeRed, was they were talking about the topic. If you read those funny letters grouped together at the beginning of the forum, it says to have a topic other than "need help" and also to specify the langauge"

Whatever, I was trying to answer his question not mock him for not following proper post ettiquet, but that is all you guys seem to care about around here...

Posted by DakeDesuDx [send private reply] at January 09, 2002, 08:58:38 PM

CodeRed... if you were to go to enough channels and use IRC often enough, you will find that not using post ettiquet can be quite annoying. Let me demonstrait... AHem!

Subject: I need help.
Body: Hi, Can I ask a question?
---
There I am sure that that would get quite annoying... but that is only an extreme level of lack of post ettiquet. I also recommend to poeple who ask questions, like the one posted below, to figure it out for themselves... incrementing is basic syntax in most langauages, and asking questions like that is filth on these boards. Normally, one of the first things show in a course is incrementing... that is way before loops in just about every book I read. If not they should be creative enough to use the assignment operate for somthing such as: x = x + 1;
Oh yes, and I have an extreme grudge against newbies, cause I was once one, and I cannot beleive I was ever that stupid... but I was.

Posted by Psion [send private reply] at January 09, 2002, 09:20:34 PM

Maybe you could both refrain from nonconstructive posts, or at least nonconstructive proofs.

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.