Please excuse my terminology if I happen to name the wrong things
I learnt that you can embed strings in texts using []
Eg.
Code: Select all
fruit = "apples"
e "I really like [fruit]" #goes into I really like apples.
like
Code: Select all
$ fruit = "apples" # or inputted dynamically
$ basket = "a bag of [fruit]"
e "this is [basket]"
How else could I approach to achieve similar results so I can call variables in variables and print them out in a text line to show? At the moment, the line will show "this is a bag of [fruit], because it doesn't recognise past the first layer of strings.
Furthermore, to explore this function further, I'm wondering if I could make the fruit variable a list
Code: Select all
fruitlist = [apples, bananas, coconut]
fruit = fruitlist[1]
e "I really like [fruit]" #will display as I really like bananas
Code: Select all
foodlist = [(bananas, apples), (soup, bread)]
fruit=foodlist[0][0] #picks the fruit tuple in foodlist
main = foodlist[1][0] # picks the main meal tuple in foodlist.
e "I usually have [fruit] after [main]."
I'm not sure if I'm putting my thoughts in the right direction. Please help shed some light in this area many thanks.