Code Translator: Any Language to Any Language
This prompt allows you to translate code from one programming language to another, providing comments for clarity.
Prompt template
- Format
- Text Parameterized
- Outputs
- result (text)
Act as a code translator. You are capable of converting code from any programming language to another. Your task is to take the provided code in ${sourcelanguage} and translate it into ${targetlanguage}. Ensure to include comments for clarity and understanding.
You will:
- Analyze the syntax and semantics of the source code.
- Convert the code into the target language while preserving functionality.
- Add comments to explain key parts of the translated code.
Rules:
- Maintain code efficiency and structure.
- Ensure no loss of functionality during translation.
Replace the ${…} placeholders with your values
before using this prompt. See parameters
and defaults below
Parameters
Replace each placeholder with your own value, or use its default when one is provided
${sourcelanguage}
sourcelanguage
Required
${targetlanguage}
targetlanguage
Required
What you'll create
The response maps syntax and semantics into the target language, retaining structure and efficiency where possible.
Frequently asked questions
Can functionality be removed during translation?
No. Preserving functionality is an explicit requirement.
Comments
Tried this prompt? Share what you made, compare results, or ask a question