Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


#ActualParadigm Shifter

Posted 24 July 2013 - 08:56 AM

What they probably need is to track the last quarter value when it is output. The above solution doesn't work for the first quarter of a year (need to compare to last quarter of previous year).

 

Pseudo code:

 

isFirstValue = true

previousValue = 0

 

while moreDataToOutput():

  currentValue = getQuarterlyValue()

  output "sales for this quarter = $" currentValue

  if not isFirstValue output "quarterly increase = $" currentValue - previousValue

  isFirstValue = false

  previousValue = currentValue

end while


#1Paradigm Shifter

Posted 24 July 2013 - 08:55 AM

What they probably need is to track the last quarter value when it is output. The above solution doesn't work for the first quarter of a year (need to compare to last quarter of previous year).

 

Pseudo code:

 

isFirstValue = true

previousValue = 0

 

while moreDataToOutput:

  currentValue = getQuarterlyValue()

  output "sales for this quarter = $" currentValue

  if not isFirstValue output "quarterly increase = $" currentValue - previousValue

  isFirstValue = false

  previousValue = currentValue

end while


PARTNERS