All puzzles
Per page
E
if · else · &&

Log in

When someone clicks the loginButton button, go to the homeScreen screen only if the userInput text box says ada and the passInput text box says 1815. Otherwise, show "Try again." in the messageLabel label.

If someone types ada as the user name and 1234 as the password, the messageLabel label shows Try again.

10 strips: E1 to E10

}
E1
if (user == "ada" || pass == "1815") {
E2
setText("messageLabel", "Try again.");
E3
});
E4
} else {
E5
setScreen("homeScreen");
E6
var user = getText("userInput");
E7
if (user == "ada" && pass == "1815") {
E8
onEvent("loginButton", "click", function() {
E9
var pass = getText("passInput");
E10

Answer key: E. Log in

Order: E9, E7, E10, E8, E6, E5, E3, E1, E4. Extra: E2

Lines with the same mark can go in either order.

onEvent("loginButton", "click", function() {
	var user = getText("userInput");
	var pass = getText("passInput");
	if (user == "ada" && pass == "1815") {
		setScreen("homeScreen");
	} else {
		setText("messageLabel", "Try again.");
	}
});

Extra strip: if (user == "ada" || pass == "1815") {. With ||, only one of the two has to be right, so the user name ada gets in with any password.