⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 proc.bas

📁 smallbasic for linux
💻 BAS
字号:
dim va(4)for i=0 to 4  va(i)=inext' array copyvn()=va()for i=0 to 4  ? vn(i)next' ==== proceduresproc1proc2 "String test"proc2 1/2proc3 1,2proc4 4i=-1proc5 va(),4if i<>-1 then ? "PROC5 failed" else ? "proc5: ok"i=-1proc6 iif i<>6 then ? "PROC6 failed" else ? "proc6: ok"proc6 va(1)if va(1)<>6 then ? "PROC6 failed" else ? "proc6: ok"' recursioni=1rec i'==== functions? "f(x)=";f(8)x=8? f(1)+1+sqr(f(x))+4'==== return array!vn()=fillarrayfor i=0 to ubound(vn)  ? vn(i)next' passing arrays byreffillarr2 vn()for i=0 to ubound(vn)  ? vn(i)next' ===dim vv(4)vv()=fill3(vv())end' Simple proceduresub proc1? "Proc1: no parameters"end' 1 parameter proceduresub proc2(a)? "Proc2=";aend' 2 parameter proceduresub proc3(a,b)? "Proc3=";a+bend' local proceduressub proc4(a)  sub proc5(b)    sub proc6(b)      ? "sub-proc6=";b    end  ? "sub-proc5=";b  proc6 b  end? "Proc4=";aproc5 a:REM local sub proc5 has priorityend' null-arrays as parametersub proc5(x(),count)local ifor i=0 to count  ? "Proc5 - Array="; x(i)nextend' byrefsub proc6(byref n)n=6endfunc f(x)f=2^xendsub rec(byref n)local sn=n+1s=n? "R:";nif n<10  rec nfi? "REXIT:";sendfunc fillarraylocal v(),idim v(16)for i=0 to 16	v(i) = 16-inextfillarray=v()endsub fillarr2(byref v())local ifor i=0 to 16	v(i) = inextendfunc fill3(v())v(0)=1fill3=v()end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -