I want to write a TCL program for a given input string “Hello I Am Fine” , whose output must be: “Fine Am I Hello“
Also Want to know, how to find the last element within a list of elements?
Eg: [list 10 20 30 40 50 60 70 80 90 100]
— So from this list i want to use the last element.
Thanks.
If you need the last element of a list, you can access it with
If you want to know the index of the last element, use
If you want to reverse a list, use
Simple as that.
And for the the Input/Output thing, I suggest first
splitit into a list, then reverse it, andjointhe result again. I leave it to you as exercise.