List Contains Element Base Property
If the first element of the list is equal to the value you are looking for, then the list contains the value.
if x = value, then stack [ x, y ] contains value = True
Examples
if 5 = 5, then stack [ 5, [ 10, [ 15, [ ] ] ] ] contains 5 = True
if "Apple" = "Apple", then stack [ "Apple", [ "Banana", [ "Cherry", [ ] ] ] ] contains "Apple" = True
if True = True, then stack [ True, [ False, [ ] ] ] contains True = True
The examples are a bit odd because they are only showing cases where 'x' is equal to 'value' (of course 5 is equal to 5!). But 'x' often does not match 'value,' and we have to look at the rest of the elements on the list.
Please fill in the blank:
if 2 == 2, then (list [ 2, [ 4, [ 8, [ ] ] ] ] contains 2) = _____
Comments
Please log in to add comments