RE: Multiplying using for loop

new topic     » topic index » view thread      » older message » newer message

first off, temp1 isnt assigned a value.
second, (based on the code you posted)

temp0 = PrettyNumbers(ansF0)
  should be
temp0 = PrettyNumbers(answerF0)

third, 

you are trying to assign an atom to a sequence and the sprint() isnt
needed.
temp1 = answerF0 * sprint(i)  -- try to muliply anwser by i

try changing 
for i = 0 to 10 do  -- Start of for loop
temp1 = answerF0 * sprint(i)  -- try to muliply anwser by i
addItem( ListH, temp1)  -- add results to listbox
end for

to

for i = 0 to 10 do  -- Start of for loop
temp1 = PrettyNumbers(answerF0 * i)  -- try to muliply anwser by i
addItem( ListH, temp1)  -- add results to listbox
end for



Regards, 
   Robert Szalay


Starion wrote:
> 
> 
> Hi,
>     I'm woring on a Windows 95 GUI program with Win32LIB
>     I'm trying to multiply the contents of a text box by a value using 
> the "for loop".  Here's the pseudocode:
> 
> for i = 0 to 10
>    x = number from TextBox F0
>     x multiplied by i = y
>    add y to a listbox control
> next
> 
> I think I'm not correctly converting numbers and sequences?  Or am I 
> using the wrong declarations?
> 
> If anyone needs the function PrettyNumbers, I'll send it.  I would copy 
> the error log file, but it's 54 KB.  I can e-mail it though.
> 
> 
> Here's the code I have:
> 
> 
> procedure PushButton3_onClick (...)--params is ()
> 
> atom answerF0
> sequence temp0, temp1
> 
> answerF0 = getNumber(txtF0)
> temp0 = PrettyNumbers(ansF0)
> 
> -- Function PrettyNumbers takes an integer and makes
> -- a sequence with commas every 3 digits.
> 
> 
> addItem( ListH, temp0 )  -- Simple addItem code that works
> 
> for i = 0 to 10 do  -- Start of for loop
> 	temp1 = answerF0 * sprint(i)  -- try to muliply anwser by i
> 	addItem( ListH, temp1)  -- add results to listbox
> end for
> 
> 
> Regards,
>     Sim
> 
> 
> "The water hole? What's so great about the water hole?" - Young Nala
>

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu