Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Addition Loop Problem
#21
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. 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.
Reply
#22
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
Reply
#23
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!
Reply
#24
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.
Reply
#25
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.
Reply
#26
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:
Reply
#27
Quote:[...] I don't think += should be allowed at all, nor "?"

? is in BASIC since the 70s. Try it.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#28
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.
Reply
#29
Quote:Tis, tis an old one in Basic I know... but it's just a bit old..
So is QBasic ... :roll:
stylin:
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)