Code Translator: Any Language to Any Language

This prompt allows you to translate code from one programming language to another, providing comments for clarity.

Prompts Chat Republished on Sep 14 0 Bookmarks 0 Copies
Bookmark 0

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

Up to 4 results. Images up to 2 MB; MP4, WebM, or MOV videos up to 4 MB each