Small Basic Forum

Full Version: Diving into Z-S's SB.js web program
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Z-S shared me a project while I started to create SBJS, and I think it's fast enough, very well engineered.
First I tried this:
Code:
textwindow.writeline("hello, world!");
It probably made sense to include a semicolon, because it maybe was just custom JS objects + classes running with eval() on the background.
Then went on to test some classic SB syntax:
Code:
for i=1 to 5
textwindow.write("Hello, world! ");
endfor
Surprisingly, it worked.
Then tested this:
Code:
uinput = textwindow.read();
textwindow.writeline(uinput);

Also it used the browser's native input box dialog instead of a text cursor within the console.
Then tested JS multiline notes:
Code:
/* Multiline notes
on SB.js */
It was ignored. Didn't throw any errors.
It probably supported my belief of custom JS objects + classes on the background running with eval(). Z-S is truly a web mastermind, and I appreciate that.
Anyway you can try Z-S's SB.js at https://www.zs.rf.gd/SBJS/
Made sub to work like function and also return value
Let's go!!!!

Anyways this actually worked!
sub greet(name)
textwindow.writeline("Good morning, "+name+"!")
endsub

greet("sm4llprogrammer2008")

Another program cleverly worked:
sub greet(name)
textwindow.writeline("Good morning, "+name+"!");
endsub

greet("sm4llprogrammer2008");

sub repeat(times)
for i=1 to times
textwindow.writeline("Hello, I repeated "+i+" times!");
endfor
endsub

repeat(10)

Maybe improve conditional branching, adding stuff like if [x] = [y] then ... elseif [x] = [y] then ... endif