Correct way of nested If/else

Can someone direct me to information about how to do multiple/nested if/else properly?

I have a location that you should not be able to enter unless you are carrying a set of keys and the score is 100.

So code starts with ‘Instead of going inside from location x…’

I want to return different text for different combinations of having/not having the keys and score is/is not 100.

Sure this is simple but I’m struggling with execution.

Here’s what I’d do. (Someone else might have a better way!)

Check going inside from the wherever:
	if player does not carry key:
		if score is less than 100:
			say "Sorry, no key and your score's too low." instead;
		else:
			say "Sorry, no key." instead;
	else if score is less than 100:
		say "Sorry, your score's too low." instead.
2 Likes