avanzarVersion
Increments the version number following a custom versioning scheme where minor versions go from 0 to 8, then roll over to the next major version.Function Signature
Parameters
The current version string in the format “major.minor” (e.g., “1.5”, “2.8”)
Returns
The next version number according to the versioning rules:
- If minor version is 8, increments major version and resets minor to 0
- Otherwise, increments minor version by 1
Behavior
The function implements a specific versioning scheme:- Standard increment: Minor versions 0-7 increment normally (e.g., 1.5 → 1.6)
- Rollover at 8: When minor version is 8, it rolls over to the next major version with minor 0 (e.g., 2.8 → 3.0)
Examples
Edge Cases
Version 8 Rollover: The function treats minor version “8” as the maximum before rolling over to the next major version. This creates a 0-8 range (9 possible minor versions) rather than the traditional 0-9 range.
Implementation Details
The function uses string splitting and parsing to handle version numbers:- Splits the version string on the ”.” delimiter
- Checks if the minor version equals “8” (string comparison)
- If yes: increments the major version and sets minor to 0
- If no: keeps the major version and increments the minor version
The function expects well-formed version strings with exactly one decimal point. It does not include input validation, so ensure version strings follow the “major.minor” format.