templates are code parts who are every time used again
These are subroutines, functions or methods.
Templates are good for markup languages (like HTML), where content is clearly separated from structure and presentation (you provide the content, while templates take care of structure and presentation), but I don't see a point in templates for programming languages. All you posted in your first post are examples, because only examples are useful in case of programming languages (in fact, you can use them as a mini-templates). Templates could look like
for [your variable] = [from], [to] do
[your code]
end
but what would be the point of it? How would it be helpful in writing programs? If you know the syntax of a language, you'll write something like that from scratch quicker than it would take you to use a template. If you don't know the syntax, well... you should learn it. This is not HTML, when you can download a nice template, change the content (text, pictures etc.) and have a good looking website.