File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Example Functions
2+
3+ ````
4+ //Some functions to use in BScript.
5+
6+ //Do note functions are supported in the current version of BScript.
7+
8+ //Function that takes two parameters and returns their sum
9+ func add x, y {
10+ var w;
11+
12+ (w, y) {
13+ x +;
14+ w +;
15+ }
16+
17+ return x;
18+ }
19+
20+ //Function that takes two parameters and returns their difference
21+ func subtract x, y {
22+ var w;
23+
24+ (w, y) {
25+ x -;
26+ w +;
27+ }
28+
29+ return x;
30+ }
31+
32+ //Function that takes two parameters and returns their product
33+ func multiply x,y {
34+ var w;
35+
36+ (w, y) {
37+ x = add x, x;
38+ w +;
39+ }
40+ return x;
41+ }
42+
43+ //I actually could not figure out how to make a division function. If anybody figures it out, please tell me!
44+ ````
45+
46+ [ Download the file here!] ( "ExampleFunctions.bs" )
Original file line number Diff line number Diff line change @@ -36,6 +36,6 @@ a=addOne 1; //a equals 2 now.
3636
3737Functions can do a lot, and since I'm nice I'll provide some functions you can put into your own code!
3838
39- [ You can see them here!] ( ExampleFunctions.bs )
39+ [ You can see them here!] ( examplefunctions.html )
4040
4141[ < Previous Page] ( basics.html ) | [ Next Page >] ( screenfunctions.html )
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 " />
5+ < title > BScript Docs</ title >
6+ < link rel ="stylesheet " href ="styles.css ">
7+ < link rel ="icon " href ="assets/icon.png ">
8+ </ head >
9+ < body >
10+
11+ < div id ="content "> Loading...</ div >
12+
13+ < script src ="https://cdn.jsdelivr.net/npm/markdown-it/dist/markdown-it.min.js "> </ script >
14+ < script >
15+ async function loadMarkdown ( url ) {
16+ const res = await fetch ( url ) ;
17+ const mdText = await res . text ( ) ;
18+
19+ const md = markdownit ( {
20+ html : true ,
21+ linkify : true ,
22+ typographer : true
23+ } )
24+ const result = md . render ( mdText ) ;
25+
26+ document . getElementById ( 'content' ) . innerHTML = result ;
27+ }
28+
29+ // Change 'README.md' to your markdown filename or path
30+ loadMarkdown ( 'ExampleFunctions.md' ) ;
31+ </ script >
32+
33+ </ body >
34+ </ html >
35+
You can’t perform that action at this time.
0 commit comments