User Tools

Site Tools


el:include

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

el:include [2016/01/01 22:39] (current)
Line 1: Line 1:
 +===== Include =====
  
 +==== Format ====
 +
 +**include** "​path_to_file"​
 +
 +==== Description ====
 +
 +Loads an external source file at compile (when the run button is pressed) time into the program. ​ The argument to the Include statement must be a string constant.
 +
 +==== Example ====
 +
 +== saved as smilerandom.kbs ==
 +<​code>​
 +include "​smilesubroutine.kbs"​
 +clg
 +while true
 +   call drawsmile(300*rand,​ 300*rand, 50*rand+5)
 +end while
 +end
 +</​code>​
 +== saved as smilesubroutine.kbs ==
 +<​code>​
 +subroutine drawsmile(x,​y,​r)
 +   # draw a smile with the center at x,y and with a radius of r
 +   # position and size everything based on fractional multiples of the radius
 +   color black, yellow
 +   ​penwidth 1
 +   ​circle x, y, r
 +   color black
 +   ​circle x, y+.2*r, .5*r
 +   color yellow
 +   ​circle x, y, .5*r
 +   color black
 +   eye = int(.1*r)
 +   if eye=0 then eye = 1
 +   ​circle x-.35*r, y-.3*r, eye
 +   ​circle x+.35*r, y-.3*r, eye
 +end subroutine
 +</​code>​
 +
 +
 +==== See Also ====
 +{{page>​en:​start#​Other Statements and Functions&​noheader}}
el/include.txt ยท Last modified: 2016/01/01 22:39 (external edit)