Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ CodeForge 是一款轻量级、高性能的桌面代码执行器,专为开发

<div style="display: flex; align-items: center; justify-content: center;">
<img src="public/icons/c.svg" width="60" alt="C">
<img src="public/icons/cangjie.svg" width="60" alt="Cangjie">
<img src="public/icons/clojure.svg" width="60" alt="Clojure">
<img src="public/icons/cpp.svg" width="60" alt="C++">
<img src="public/icons/css.svg" width="60" alt="CSS">
Expand All @@ -39,6 +40,7 @@ CodeForge 是一款轻量级、高性能的桌面代码执行器,专为开发
<img src="public/icons/php.svg" width="60" alt="PHP">
<img src="public/icons/python.svg" width="60" alt="Python 2">
<img src="public/icons/python.svg" width="60" alt="Python 3">
<img src="public/icons/r.svg" width="60" alt="R">
<img src="public/icons/ruby.svg" width="60" alt="Ruby">
<img src="public/icons/rust.svg" width="60" alt="Rust">
<img src="public/icons/shell.svg" width="60" alt="Shell">
Expand Down
5 changes: 5 additions & 0 deletions public/icons/cangjie.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions public/icons/r.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions src-tauri/src/examples/cangjie.cj
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// 仓颉示例代码 - CodeForge 代码执行环境

main(): Unit {
println("🎉 欢迎使用 CodeForge!")
println("Welcome to CodeForge!")
println("")

println("=========================================")
println(" CodeForge Cangjie ")
println("=========================================")
println("")

// 基本输出示例
println("✅ 仓颉运行成功! (Cangjie is working!)")
println("⚡ 这是仓颉程序 (This is Cangjie program)")
println("")

// 变量操作
let name = "CodeForge"
let version = "Cangjie"
let number1 = 10
let number2 = 20
let result = number1 + number2

println("🔢 简单计算 (Simple calculation):")
println("${number1} + ${number2} = ${result}")
println("")

// 字符串操作和插值
println("📝 字符串操作 (String operations):")
println("平台名称 (Platform): ${name}")
println("语言版本 (Language): ${version}")
println("完整信息 (Full info): ${name} - ${version}")
println("")

// 数组操作
println("🍎 数组示例 (Array example):")
let fruits = ["苹果", "香蕉", "橙子", "葡萄"]
for (i in 0..fruits.size) {
println("${i + 1}. ${fruits[i]}")
}
println("")

// 条件判断
let score = 85
println("📊 成绩评估 (Score evaluation):")
if (score >= 90) {
println("优秀! (Excellent!)")
} else if (score >= 80) {
println("良好! (Good!)")
} else if (score >= 60) {
println("及格 (Pass)")
} else {
println("需要努力 (Need improvement)")
}
println("")

// 循环示例
println("🔄 循环输出 (Loop output):")
for (i in 1..6) {
println("第 ${i} 次输出 (Output #${i}): Hello from CodeForge!")
}
println("")

// while循环示例
println("🔁 While循环示例 (While loop example):")
var counter = 1
while (counter <= 3) {
println("While循环: 第 ${counter} 次")
counter += 1
}
println("")

println("🎯 CodeForge 仓颉代码执行完成!")
println("🎯 CodeForge Cangjie execution completed!")
println("")
println("感谢使用 CodeForge 代码执行环境! 🚀")
println("Thank you for using CodeForge! 🚀")
}
Loading
Loading