Example code - Classes: Revision history

Jump to navigation Jump to search

Diff selection: Mark the radio buttons of the revisions to compare and hit enter or the button at the bottom.
Legend: (cur) = difference with latest revision, (prev) = difference with preceding revision, m = minor edit.

27 January 2026

  • curprev 09:3209:32, 27 January 2026WikiSysop talk contribs 3,899 bytes +3,899 Created page with "You know how I often use primes in my examples, so I decided to make a prime number generator class as an example.<br> It is able to generate a range of primes, somewhat similar to the way '''range()''' works.<br> Wanting to be smart, I decided to store the primes I have already computed in a class variable, so I do not have to compute them again at least while the program runs.<br> I am doing a running incremental calculation of primes, storing them as I find them, and..."