Controller
flashCount()
Signature
Section titled “Signature”flashCount() — returns numeric
Available in: controller
Category: Flash Functions
Description
Section titled “Description”Returns how many keys exist in the Flash.
Examples
Section titled “Examples”// 1. Check how many keys are currently in the Flash
count = flashCount();
// count -> 0 (Flash is empty), or a positive integer when keys exist
// 2. Only render a Flash notice section when there is something to show
if (flashCount()) {
writeOutput("You have " & flashCount() & " flash message(s).");
}
// 3. Use alongside flashIsEmpty() — flashCount() powers the isEmpty check
flashInsert(notice="Saved successfully", warning="Check your email");
count = flashCount();
// count -> 2