基本语法
// 变量赋值
x = 5
y = "Hello"
// 算术运算
sum = x + 10
product = x * 2
// 打印
print("结果是: ")
printnln(sum) // 不换行打印
简单、优雅、现代的编程语言 / Simple, Elegant, Modern Programming Language
清晰直观的语法设计,易于学习和使用
x = 5
if(x > 3) {
print("Hello, BCC!")
}
支持公共和私有函数定义
def public add(x, y) {
return x + y
}
强大的代码块功能
forEach {
print("Inside block")
}
// 变量赋值
x = 5
y = "Hello"
// 算术运算
sum = x + 10
product = x * 2
// 打印
print("结果是: ")
printnln(sum) // 不换行打印
// if 语句
if(x > 0) {
print("x是正数")
}
// while 循环
while(x < 10) {
print(x)
x = x + 1
}
// for 循环
for(i = 0, i < 5, i = i + 1) {
print(i)
}
// 公共函数定义
def public add(x, y) {
return x + y
}
// 私有函数定义
def private helper() {
print("辅助函数")
}
// 带代码块参数的函数
def public forEach(block: BCC.Codeblock) {
block.execute()
}
// 导入模块
import "basicDef.bcm"
// 使用模块中的函数
result = max(5, 3)
print(result)
// 基本代码块
forEach {
print("代码块内容")
}
// 带条件的代码块
while(x < 3) {
print(x)
x = x + 1
}
def public add(x, y) {
return x + y
}
def public multiply(x, y) {
return x * y
}
result = add(5, multiply(3, 2))
print("结果: ")
print(result)
forEach {
print("第一行")
print("第二行")
print("第三行")
}
在 VSCode 扩展市场搜索 "BCC"
或者下载对应的vsix文件
创建 .bcs 文件开始编码
使用 BCC 解释器运行代码