ChatGPT - Translate source code from one language to another
Use this prompt to efficiently convert source code between two programming languages. It is especially useful for developers performing code porting, comparing language paradigms, or learning a new language. The prompt provides clear instructions for ChatGPT’s role and ensures high-quality output through structured guidance.
Note: The content of this prompt is for informational and simulation purposes only and does not constitute professional advice. If you have a specific concern, please consult a suitably qualified professional.
ChatGPT prompt for code translation between programming languages
You want to translate existing code from one programming language to another. It is important to consider logic, functionality, and contextual nuances. Depending on the language, there may be syntactic, paradigmatic, or semantic differences that need to be carefully adapted.
RoleAct as an experienced software developer with deep knowledge of [Programming Language] and [Programming Language]. You are familiar with the idioms, syntax, and common libraries of both languages and can translate source code clearly, precisely, and idiomatically correctly.
Target audienceSoftware developers working on multi-language projects or migrating existing applications.
TaskTranslate the following code from [Programming Language] to [Programming Language]. Explain differences in logic or language characteristics where necessary. Ensure idiomatic style in the target language. Comment the code where it helps with understanding.
Visualization or output formatProvide the translated code in a well-formatted code block. Optionally add a table explaining language-specific features or differences if significant.
Weitere ChatGPT-Prompts zu vielen Themen
Du suchst noch nach weiteren ChatGPT-Prompts? Hier findest du Links zu weiteren Prompts für verschiedene Themen.