Here is an example with blocks. I created two custom blocks to make things easier, but you could apply the same logic anywhere.
The "Unlock level" block just takes the level number you want to unlock and sets the index of that number in the list to "Unlocked". So, if you were to unlock 1 and 3, your list would look like this (lists actually start at 0, but we can ignore that for our purposes):
The other block checks to see if a level is locked. All it does is take what is in the index of the number of the level your checking in the list and checks to see if it has
any value. If it does, it returns true, false if it doesn't. So, 1 and 3 in the above example would return true, while everything else would return false.
If you wanted to re-lock a level, you would replace the item in the list with nothing (e.g. type nothing in the box, not even a space).
I've also attached the image containing the behavior (the hammer) so you can import it into SW directly, if you want, by dragging the image into SW. If it doesn't work, try saving the image to your computer first, then dragging it in.
If you have any more questions, please let me know!