BOOL

A boolean type. Values are true and false.

For example:

set beresp.cacheable = true;

Integer literals may not be used to assign to a BOOL variable.

Likewise there is no implicit conversion to INTEGER types:

declare local var.i INTEGER;
declare local var.b BOOL;
set var.b = true;
set var.i = 0;
set var.i += var.b; /* invalid */

Nor may STRING literals be used for assignment (i.e. "true" rather than true), however BOOL values may be converted to a STRING, and are rendered as "1" and "0" for true and false respectively:

declare local var.b BOOL;
set var.b = true;
log var.b; /* equivalent to "1" */

User contributed notes

BETA

Do you see an error in this page? Do you have an interesting use case, example or edge case people should know about? Share your knowledge and help people who are reading this page! (Comments are moderated; for support, please contact Fastly support)