Please specify version and format if asking for help, or apply optional tags above:
Twine Version: 2
Story Format: Sugarcube 2.34.1
==code==
<<set $alphabet to []>>
<<set $alphabet.push(“a”, “b”, “c”, “d”, “e”, “f”, “g”, “h”, “i”, “j”, “k”, “l”, “m”, “n”, “o”, “p”, “q”, “r”, “s”, “t”, “u”, “v”, “w”, “x”, “y”, “z”)>>
Alphabet length is $alphabet.length
This is the alphabet: $alphabet
`<<set $letter to prompt(“Which letter do you wish to remove?”)>>
<<if $alphabet.contains($letter)>>
Alright, we’ll remove $letter.
<<set $index to $alphabet.indexOf($letter)>>
<<if $index > 0>>
Alphabet length before plucking: $alphabet.length
Alphabet before plucking: $alphabet
<<set $alphabet.pluck($index, $index + 1)>>
Alphabet after plucking: $alphabet
Alphabet length after plucking: $alphabet.length
<</if>>
<<else>>
Sorry, that letter, $letter, has already been removed.
<</if>>
==endcode==
Question 1: If I request that code to remove the letter “c”, it removes a letter, but not “c”, and not the same letter twice running? Why is that?
Question 2: What do the two numbers in the pluck method do?
<<set $alphabet.pluck($index, $index + 1)>>
I set them to 3,5 thinking I would remove d, e, f, g, and h, or maybe just d and e, or d, e, and f, but only one letter is removed.
Question 3: Is it possible to indent code in this forum?