WaBasic 海龟画图
def box(length) i = 0 while i < 4 then forward(length) right(90) i = i + 1 end end i = 0 while i < 36 then if i % 2 == 0 then pencolor("blue") end if i % 2 != 0 then pencolor("red") end box(80) left(10) i = i + 1 end
运行
清空
帮助
支持操作符:
算术:+, -, *, /, %
关系:<, <=, >, >=, ==, !=
逻辑:and, or
支持语句:
if: 不支持 else
while: 注意防止死循环
def: 定义函数
内置函数:
pencolor(color): 设置画笔颜色
forward(distance), fd(d): 前进一定距离
left(deg), lt(d): 左转一定角度
right(deg), rt(d): 右转一定角度