Classify numeric scores with one threshold and summarize the decision.

threshold A selected cutoff changes which records enter the passing group.
label The summary label is derived from the count, not stored in a table.

Classify Scores

cutoff
classify_scores.lua
Replay: real traced execution (multi-file project)
local cutoff = 70
local passed = 0

for _, score in ipairs({55, 72, 91}) do
  if score >= cutoff then
    passed = passed + 1
  end
end

local label = "review"
if passed >= 2 then
  label = "ready"
end

print("cutoff=" .. cutoff)
print("passed=" .. passed)
print("label=" .. label)
local cutoff = 60
local passed = 0

for _, score in ipairs({55, 72, 91}) do
  if score >= cutoff then
    passed = passed + 1
  end
end

local label = "review"
if passed >= 2 then
  label = "ready"
end

print("cutoff=" .. cutoff)
print("passed=" .. passed)
print("label=" .. label)
local cutoff = 85
local passed = 0

for _, score in ipairs({55, 72, 91}) do
  if score >= cutoff then
    passed = passed + 1
  end
end

local label = "review"
if passed >= 2 then
  label = "ready"
end

print("cutoff=" .. cutoff)
print("passed=" .. passed)
print("label=" .. label)
  1. cutoff ← 70, passed ← 0

    1local cutoff→ 70 = 70 --@cutoff=60, 852local passed→ 0 = 0
  2. _, score in ipairs({55, 72, 91}) do

    pass 1 of 3
    4for _1, score55 in ipairs({55, 72, 91}) do5  if score >= cutoff then6    passed = passed + 1
    All 3 passes — pass 1 is the card above
    pass_scorecutoffpassed
    1155
    2272700 1
    3391701 2
  3. passed ← 1

    pass 1 of 2
    4for _, score in ipairs({55, 72, 91}) do5  if score72 >= cutoff70 then6    passed→ 1 = passed + 17  end
  4. passed ← 2

    pass 2 of 2
    4for _, score in ipairs({55, 72, 91}) do5  if score91 >= cutoff70 then6    passed→ 2 = passed + 17  end
  5. label ← review

    10local label→ review = "review"11if passed >= 2 then
  6. label ← ready

    10local label = "review"11if passed2 >= 2 then12  label→ ready = "ready"13end
  7. print("cutoff=" .. cutoff)

    15print("cutoff=" .. cutoff70)16print("passed=" .. passed2)17print("label=" .. labelready)
    outputcutoff=70
    passed=2
    label=ready
  1. cutoff ← 60, passed ← 0

    1local cutoff→ 60 = 602local passed→ 0 = 0
  2. _, score in ipairs({55, 72, 91}) do

    pass 1 of 3
    4for _1, score55 in ipairs({55, 72, 91}) do5  if score >= cutoff then6    passed = passed + 1
    All 3 passes — pass 1 is the card above
    pass_scorecutoffpassed
    1155
    2272600 1
    3391601 2
  3. passed ← 1

    pass 1 of 2
    4for _, score in ipairs({55, 72, 91}) do5  if score72 >= cutoff60 then6    passed→ 1 = passed + 17  end
  4. passed ← 2

    pass 2 of 2
    4for _, score in ipairs({55, 72, 91}) do5  if score91 >= cutoff60 then6    passed→ 2 = passed + 17  end
  5. label ← review

    10local label→ review = "review"11if passed >= 2 then
  6. label ← ready

    10local label = "review"11if passed2 >= 2 then12  label→ ready = "ready"13end
  7. print("cutoff=" .. cutoff)

    15print("cutoff=" .. cutoff60)16print("passed=" .. passed2)17print("label=" .. labelready)
    outputcutoff=60
    passed=2
    label=ready
  1. cutoff ← 85, passed ← 0

    1local cutoff→ 85 = 852local passed→ 0 = 0
  2. _, score in ipairs({55, 72, 91}) do

    pass 1 of 3
    4for _1, score55 in ipairs({55, 72, 91}) do5  if score >= cutoff then6    passed = passed + 1
    All 3 passes — pass 1 is the card above
    pass_scorecutoffpassed
    1155
    2272
    3391850 1
  3. passed ← 1

    4for _, score in ipairs({55, 72, 91}) do5  if score91 >= cutoff85 then6    passed→ 1 = passed + 17  end
  4. label ← review

    10local label→ review = "review"11if passed >= 2 then12  label = "ready"13end1415print("cutoff=" .. cutoff85)16print("passed=" .. passed1)17print("label=" .. labelreview)
    outputcutoff=85
    passed=1
    label=review