Okay, here's how I would define that prompt, aiming for clarity, comprehensiveness, and encouraging the AI to use its full capabilities:
Prompt Definition:
"Your task is to generate the 'Hello World!' program in as many distinct programming languages as you are proficient with.
For each programming language:
- Clearly state the name of the programming language.
- Provide the specific and 'classic' (i.e., most common, idiomatic, and simple) code snippet required to print the exact string "Hello World!" to the standard output (e.g., console or terminal).
- Ensure the code is a complete, minimal, and runnable example for that language. This might include necessary boilerplate like a
main function, class definition, or required imports if they are standard for a basic "Hello World" program in that language.
- Use appropriate code block formatting for each snippet.
Strive for a comprehensive list, covering a diverse range of paradigms (e.g., procedural, object-oriented, functional, scripting). Prioritize commonly known or historically significant languages. The output string should be exactly Hello World! (with the exclamation mark and capitalization as shown)."
Key elements and why they are included:
- "Your task is to generate the 'Hello World!' program...": Clear and direct instruction.
- "...in as many distinct programming languages as you are proficient with.": Encourages the AI to access its full range of knowledge without setting an impossible "all" which might vary between models. "Distinct" helps avoid minor variations of the same language.
- "For each programming language:": Sets up a structured, iterative output.
- "Clearly state the name of the programming language.": Essential for identifying each snippet.
- "Provide the specific and 'classic' (i.e., most common, idiomatic, and simple) code snippet...": This addresses your "specific" and "classic" requirement. It guides the AI away from overly complex or obscure solutions.
- "...required to print the exact string "Hello World!" to the standard output...": Specifies the exact output string and destination, ensuring consistency.
- "Ensure the code is a complete, minimal, and runnable example...": This is crucial. "Minimal" reinforces "classic," and "runnable" means it should work if copied and pasted (given the right environment). The parenthetical about
main functions, etc., provides concrete examples of what "complete" means in different contexts.
- "Use appropriate code block formatting...": For readability and usability of the generated code.
- "Strive for a comprehensive list, covering a diverse range of paradigms...": Nudges the AI towards variety rather than just listing many C-family languages, for example.
- "Prioritize commonly known or historically significant languages.": Further refines the selection towards "classic" and useful examples, rather than very obscure or niche languages.
- "The output string should be exactly
Hello World! (with the exclamation mark and capitalization as shown).": Reiterates the precise output target to avoid variations like "hello world" or "Hello, World!".
This prompt is designed to be robust enough to work across different AI models, giving them enough instruction to understand the goal while also allowing them to leverage their specific training data regarding programming languages.