BT Lang
首页
动态
文档
关于
留言
更新记录
登录
介绍
环境搭建
如何使用
代码示例
语法说明
输出
使用注释
声明变量
声明常量
数据类型
字符串模板
运算符
条件语句
Number数字操作
len
from_char
to_number
to_fixed
to_string
to_radix
to_exponential
String字符串操作
len
trim
char
char_code
concat
ends_with
contain
index
last_index
repeat
replace
search
match
slice
split
starts_with
substr
to_radix
to_lowercase
to_uppercase
to_number
to_string
escape_html
unescape_html
parse
Array数组操作
len
to_string
join
each
pop
push
shift
unshift
sort
reverse
slice
splice
concat
contain
index
last_index
find
find_index
find_last
find_last_index
every
some
filter
map
reduce
reduce_right
fill
flat
flat_map
keys
values
entries
clone
delete
Object对象操作
len
to_string
keys
values
reverse
concat
clone
delete
key_exists
each
map
fn函数
Regex正则表达式
语法
修饰符
字符类
元字符
重复匹配
空匹配
分组与标志
ASCII 字符类
Unicode支持
循环遍历
For循环
While 循环
Loop 循环
关键字
use
class类
date日期
fs文件操作
get_path
read
write
prepend
append
size
rename
copy
delete
create_dir
create_file
list
is_dir
is_file
is_relative
is_absolute
is_symlink
is_exists
basename
filename
extension
系统函数
envs
env
has_envs
has_env
pause
echo
bool
eval
exit
include
type
call
number
string
float
int
array
object
json
regex
radix
parse_json
parse_radix_int
parse_radix_str
char_code
from_char
is_empty
is_null
sleep
rand
http库
header
status_code
redirect
url
get
post
method
server
files
cookie
session
mysql库
query
bind
all
one
exec
math库
abs
powf
sqrt
cbrt
exp
exp2
expm1
log10
log2
log1p
sin
cos
tan
asin
acos
atan
atan2
sinh
cosh
tanh
asinh
acosh
atanh
round
ceil
floor
trunc
min
max
md5库
base64库
reqwest库
method
header
cookie
cookie_store
body
timeout
query
proxy
redirect_policy
send
process库
arg
args
get_args
env
env_clear
env_remove
envs
get_envs
current_dir
get_current_dir
bind_stdio
exit_status
get_program
status
output
stdin
stdout
child
pid
kill
wait
try_wait
stdin_write
stdout_read
stdout_read_lines
stderr_read
stderr_read_lines
inherit_stdio
null_stdio
child_running
BT编程语言文档
注释
功能
注释是写给人看的说明文字,解释代码为什么这样写、某段逻辑的边界是什么,或临时记录需要注意的事项。BT 运行代码时会忽略注释,注释不会产生变量、返回值或运行时开销。
单行注释
单行注释从
//
开始,到当前行结束为止。适合解释一行代码、标记一个短说明,或在调试时临时关闭一行代码。
// 计算用户本次订单总价 total = price * count
多行注释
多行注释从
/*
开始,到
*/
结束。适合说明一段算法、接口约定、配置块,或临时关闭多行代码。
/* 这里先校验用户是否登录。 后续如果接入权限系统,可以在这里增加角色判断。 */ if !user_id { return '未登录' }
使用建议
写“为什么”,少写代码已经能直接看出的“做了什么”。
单行说明用
//
,跨多行说明或大段临时屏蔽用
/* ... */
。
注释应跟代码保持同步;过期注释比没有注释更容易误导读者。