Make ProgressMeter description display depends on a for-loop variable

K5Julien
Fri, 26 Jul 2024 10:37:58 +0000
General Usage

The following works well:

using ProgressMeter
@showprogress dt=1 desc="Computing ..." for c in 1:100_000
    # Some computing
end

However, I’d like the description to display some string that depends on c:

using ProgressMeter
@showprogress dt=1 desc="Computing $c..." for c in 1:100_000 # this throws an error
    # Some computing
end

Or ideally:

using ProgressMeter
@showprogress dt=1 desc="Computing $(c % 100 == 0 ? c : "")..." for c in 1:100_000  # this throws an error
    # Some computing
end

Is that easily achievable?

4 posts - 3 participants