Posts: 3,368
Threads: 195
Joined: Jan 2003
It's good that he got a bunch of responses from you all, but...:
Quote:number += number
Quote:? A
Quote:ostr = str(number) + " + " + str(number) + " = " + str(number + number)
Quote:sub doubleit(seed as integer,bound as integer)
I don't know whether to say "LMAO" or cry.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 235
Threads: 30
Joined: Jun 2002
heh i forgot '+=' is an FB thing
url=http://www.smithcosoft.com]SmithcoSoft Creations[/url]
"If you make it idiot proof, someone will make a better idiot" - Murphy's Law
Posts: 2,771
Threads: 96
Joined: Oct 2003
Quote:I don't know whether to say "LMAO" or cry. :cry:
I get the same feeling when I see unindented code. Huh Aga???! huh huh huh!
Posts: 3,368
Threads: 195
Joined: Jan 2003
Indented code is just an excuse for complicated code!
And, I don't think += should be allowed at all, nor "?", nor functions for simple things like this, or variables named "ostr", in this example at least...
:evil: :evil: :evil:
Nothing personal.... I just don't like overcomplication OR oversimplification.. somewhat subjective, yes, but still...
I fear I may have created a monster when I suggested touched off the "merging QB/FB" proposition..
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 108
Threads: 0
Joined: Jan 2006
Quote:RyanKelly Wrote:Note that bad stuff will happen if you try - for some unknown reason - to do this recursively.
Ok, thanks for the advice. Skip the resursive function, Hybrid. :roll:
Actually, the same problems will crop up with any of the techniques posted. Trying to calculate 2^16 in with 16 bit signed integers in QB will generate an overflow error no matter how you do it.
Posts: 324
Threads: 12
Joined: Nov 2005
RyanKelly, obviously you should use data types that meet - or perhaps exceed - whatever needs you have. If you plan on using numbers bigger than a certain data type can represent, then that's just poor design anyway.
My point was that recursion not only
1. makes this less readily apparent,
2. introduces new ways to confuse a debugger (you and me) about the source of the design problem, and
3. unnecessarily complicates an otherwise easy task.
With recursion, like anything else, use it when it makes code clearer, more elegant, more efficient or whatever your needs happen to be at the time.
stylin:
Posts: 6,419
Threads: 74
Joined: Mar 2002
Quote:[...] I don't think += should be allowed at all, nor "?"
? is in BASIC since the 70s. Try it.
Posts: 3,368
Threads: 195
Joined: Jan 2003
Tis, tis an old one in Basic I know... but it's just a bit old..
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 324
Threads: 12
Joined: Nov 2005
Quote:Tis, tis an old one in Basic I know... but it's just a bit old..
So is QBasic ... :roll:
stylin: