All puzzles
Per page
C
if · else if · Boundaries

Ticket price

When someone clicks the priceButton button, show the ticket price in the priceLabel label. Kids 12 and under pay $8. People 65 and older pay $9. Everyone else pays $12.

If someone types 65 into the ageInput text box, the label shows $9.

11 strips: C1 to C11

});
C1
} else if (age > 65) {
C2
var age = getNumber("ageInput");
C3
}
C4
price = 9;
C5
price = 8;
C6
var price = 12;
C7
setText("priceLabel", "$" + price);
C8
if (age <= 12) {
C9
onEvent("priceButton", "click", function() {
C10
} else if (age >= 65) {
C11

Answer key: C. Ticket price

Order: C10, C3, C7, C9, C6, C11, C5, C4, C8, C1. Extra: C2

Lines with the same mark can go in either order.

onEvent("priceButton", "click", function() {
	var age = getNumber("ageInput");
	var price = 12;
	if (age <= 12) {
		price = 8;
	} else if (age >= 65) {
		price = 9;
	}
	setText("priceLabel", "$" + price);
});

Extra strip: } else if (age > 65) {. With > 65, someone who is exactly 65 is not counted, so they pay $12.