Code Snippet / Code Templates
Code snippets allow the developer to add a complex coding structure by typing a minimal amount of text. Code snippets can only be used in a valid context (statements snippets are only offered when you can insert statements).
For example, using the Eclipse IDE to code in Java, a developer can type in "instanceof" then press Ctrl+space which will replace "instanceof" by the following code snippet:
- if (obj instanceof MyClass) {
- MyClass myClazz = (MyClass) obj;
- }
This code snippet can be further customised by the developer, with the IDE placing the cursor:
- on the "obj" variable to choose between the available variables at this point,
- on the "MyClass" type to allow the developer to choose the type, after he pressed the tab key,
- on the "myClass" variable to allow the developer to rename the local variable, after he pressed the tab key,
- on line 3 to allow the developer to continue typing the rest of the code, after he pressed the tab key.
Read more about this topic: Content Assist
Famous quotes containing the word code:
“Acknowledge your will and speak to us all, This alone is what I will to be! Hang your own penal code up above you: we want to be its enforcers!”
—Friedrich Nietzsche (18441900)