CodeRun 使用帮助CodeRun Help

概述Overview

CodeRun 是一款在手机上运行和编辑代码片段的工具。它内置 600 多种编程语言——从 Python、Java、Swift、C#、JavaScript、C++ 等主流语言,到 Brainfuck、INTERCAL、Malbolge 这类极客专属的冷门语言。无需在电脑上配置开发环境,打开就能写、就能跑。

CodeRun is a tool for running and editing code snippets on your phone. It comes with over 600 programming languages — from mainstream ones like Python, Java, Swift, C#, JavaScript, and C++, to geek-only niche languages like Brainfuck, INTERCAL, and Malbolge. No need to set up a development environment on your computer — just open it and start writing and running.

主要功能:

Key features:

  • 海量语言Massive Language Support600 多种语言,主流与冷门一网打尽。Over 600 languages, covering everything from mainstream to niche.
  • 即写即跑Write & Run Instantly输入代码一键运行,执行结果逐条实时返回,支持传入输入参数。One tap to run your code, with results returned in real time and support for input arguments.
  • 专业编辑器Professional Editor基于 Monaco 内核,支持语法高亮、代码提示与格式化。Built on the Monaco engine, with syntax highlighting, code hints, and formatting.
  • 内置示例Built-in Examples每种语言都带有 Hello World 示例,点开即可体验。Every language ships with a Hello World example — open and try it instantly.
  • 内置浏览器Built-in Browser打开 AI 网站等任意网页,边问边学、随查随用;支持把聊天或代码内容一键保存到文件管理器。Open any webpage such as AI sites to learn on the go; save chats or code to the file manager in one tap.
  • 文件管理器File Manager内置文件管理,可通过 WiFi 在手机与电脑之间互传代码文件,支持重命名、删除与分享。Built-in file management with WiFi transfer between phone and computer; supports rename, delete, and share.

代码编辑区域Code Editing Areas

编辑器由以下区域组成,各司其职:

The editor is made up of the following areas, each with its own role:

  • Header 区域Header:在代码执行前添加的代码片段(如导入语句、函数定义等)code added before execution (imports, function definitions, etc.)
  • 代码区域Code area:编写主要代码where you write your main code
  • Footer 区域Footer:在代码执行后添加的代码片段(如清理代码、测试代码等)code added after execution (cleanup, tests, etc.)
  • 输入区域Input area:提供标准输入(stdin)provides standard input (stdin)
  • 输出区域Output area:显示程序执行结果shows the program output
  • 调试区域Debug area:显示执行过程中的调试信息shows debug information during execution

参数设置Parameter Settings

· 编译器标志(Compiler Flags)Compiler Flags

用于设置编译器的编译选项,例如:Set compiler options, for example:

-O2 # 优化级别2optimization level 2 -Wall # 显示所有警告show all warnings -std=c++11 # 使用C++11标准use the C++11 standard

使用方法:

How to use:

  1. 点击“+”按钮添加新的编译器标志Tap the “+” button to add a new compiler flag
  2. 在文本框中输入标志内容Enter the flag in the text field
  3. 点击“-”按钮删除不需要的标志Tap the “−” button to remove flags you no longer need

· 命令选项(Command Options)Command Options

用于设置程序运行时的命令行选项,例如:Set command-line options used when the program runs, for example:

--verbose # 详细输出模式verbose output mode --help # 显示帮助信息show help

· 驱动选项(Driver Options)Driver Options

用于设置语言特定的驱动选项。Set language-specific driver options.

· Header 和 FooterHeader & Footer

用于在代码执行前后添加额外的代码片段:Add extra code before or after your main code:

Header(头部)Header

  • 在代码执行前添加的代码code added before execution
  • 常用于导入库、定义函数、设置环境等commonly used for imports, function definitions, and environment setup
  • 示例:Python 的 import 语句,C++ 的 include 语句e.g., Python import and C++ #include

Footer(尾部)Footer

  • 在代码执行后添加的代码code added after execution
  • 常用于清理资源、运行测试、输出结果等commonly used for cleanup, running tests, and printing results
  • 示例:调用主函数、清理内存等e.g., calling the main function, freeing memory

· 参数(Arguments)Arguments

传递给程序的主函数参数,例如:Arguments passed to the program’s main function, for example:

arg1 arg2 arg3

语言选择Language Selection

点击右上角的语言搜索按钮,可以搜索和选择支持的编程语言。Tap the language-search button in the top-right corner to search for and select a supported programming language.

文件操作File Operations

· 保存文件Save File

  • 点击操作菜单 → “保存文件”Open the action menu → “Save File”
  • 支持保存为 .snip 格式的文件Supports saving files in the .snip format

· 文件管理File Manager

  • 点击操作菜单 → “文件管理”Open the action menu → “File Manager”
  • 浏览和管理本地保存的代码文件Browse and manage your locally saved code files

· 自动保存Auto-save

  • 系统会自动保存当前编辑的内容The app automatically saves what you are editing
  • 自动保存文件名为:auto_save_语言ID.snipAuto-saved files are named: auto_save_languageID.snip

运行代码Running Code

点击“运行”按钮执行代码,系统会:Tap “Run” to execute your code. The app will:

  1. 编译并执行代码Compile and run the code
  2. 显示执行结果和调试信息Display the results and debug information

支持的编程语言Supported Languages

工具支持多种编程语言,包括但不限于:The tool supports many programming languages, including but not limited to:

JavaScript (node)
Python (python3)
Java (java)
C++ (cpp)
C (c)
C# (csharp)
PHP (php)
Ruby (ruby)
Go (go)
Rust (rust)
Swift (swift)
Kotlin (kotlin)

以及更多………and many more.

使用示例Examples

例 1 · 运行 Python 代码Run Python code

  1. 选择语言:Select language: Python
  2. 在代码区域输入:Enter the following in the code area:
    print("Hello, World!")
  3. 点击“运行”按钮Tap “Run”

例 2 · 带输入的程序A program with input

  1. 选择语言:Select language: Python
  2. 在代码区域输入:Enter the following in the code area:
    name = input("请输入你的名字:") print(f"你好,{name}!")
  3. 在输入区域输入:Enter the following in the input area: 张三
  4. 点击“运行”按钮Tap “Run”

例 3 · 使用 Header 和 FooterUse Header & Footer

  1. 选择语言:Select language: Python
  2. 在 Header 区域输入:Enter the following in the Header area:
    import math def calculate_circle_area(radius): return math.pi * radius * radius
  3. 在代码区域输入:Enter the following in the code area:
    radius = 5 area = calculate_circle_area(radius) print(f"半径为{radius}的圆面积是:{area:.2f}")
  4. 在 Footer 区域输入:Enter the following in the Footer area:
    # 测试不同半径 for r in [3, 7, 10]: area = calculate_circle_area(r) print(f"半径{r} -> 面积{area:.2f}")
  5. 点击“运行”按钮Tap “Run”

例 4 · 使用编译器标志Use compiler flags

  1. 选择语言:Select language: C++
  2. 在代码区域输入:Enter the following in the code area:
    #include <iostream> using namespace std; int main() { #ifdef DEBUG cout << "调试模式" << endl; #endif cout << "Hello, World!" << endl; return 0; }
  3. 在编译器标志区域添加:Add to the compiler-flags area: -DDEBUG
  4. 点击“运行”按钮Tap “Run”

常见问题FAQ

Q:为什么代码运行失败?Q: Why does my code fail to run?
可能的原因包括:代码语法错误;网络连接问题;网络服务暂时不可用,请稍后重试。Possible reasons include: a syntax error in the code; a network connection problem; or the online service being temporarily unavailable — please try again later.
Q:如何查看详细的错误信息?Q: How do I see detailed error messages?
查看调试区域,其中会显示编译和执行的详细过程。Check the Debug area — it shows the detailed compilation and execution process.
Q:支持哪些文件格式?Q: What file formats are supported?
主要支持 .snip 格式的文件,可以保存和加载代码片段。The .snip format is mainly supported, for saving and loading code snippets.
Q:如何切换语言?Q: How do I switch language?
点击右上角的语言搜索按钮,输入语言名称搜索并选择。Tap the language-search button in the top-right corner, type the language name, and select it.

注意事项Notes

  • 1代码执行时间有限制,请避免运行长时间的程序。There is a time limit on code execution — avoid running long programs.
  • 2网络连接不稳定时可能影响代码执行。An unstable network may affect code execution.
  • 3部分语言可能需要特定的编译选项。Some languages may require specific compiler options.
  • 4建议定期保存重要代码。We recommend saving important code regularly.

技术支持Support

如有问题或建议,请联系我们。If you have any questions or suggestions, please contact us.