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

📄 yabasic.1

📁 Linux下VB解释器
💻 1
📖 第 1 页 / 共 5 页
字号:
   clear, circle, rectangle, triangle     _________________________________________________________________Name   clear screen - erases the text windowSynopsisclear screenDescription   clear screen erases the text window (the window where the output of print   appears).   It must be issued at least once, before some advanced screen-commands (e.g.   print at or inkey$) may be called; this requirement is due to some   limitations of the curses-library, which is used by yabasic under Unix for   some commands.Exampleclear screenprint "Please press a key : ";a$=inkey$print a$             The clear screen command is essential here; if it would be omitted, yabasic   would issue an error ("need to call 'clear screen' first") while trying to   execute the inkey$-function.See also   inkey$     _________________________________________________________________Name   clear window - clear the graphic window and begin a new page, if printing is   under waySynopsisclear windowDescription   clear window clears the graphic window. If you have started printing the   graphic via open printer, the clear window-command starts a new page as   well.Exampleopen window 200,200open printer "t.ps"for a=1 to 10if (a>1) clear windowtext 100,100,"Hallo "+str$(a)next aclose printerclose window             This example prints 10 pages, with the text "Hello 1", "Hello 2", ... and so   on. The clear screen-command clears the graphics window and starts a new   page.See also   open window, open printer     _________________________________________________________________Name   close - close a file, which has been opened beforeSynopsisclose filenumclose # filenumDescription   The close-command closes an open file. You should issue this command as soon   as you are done with reading from or writing to a file.Exampleopen "my.data" for reading as 1input #1 aprint aclose 1             This program opens the file "my.data", reads a number from it, prints this   number and closes the file again.See also   open     _________________________________________________________________Name   close curve - close a curve, that has been drawn by the line-commandSynopsisnew curveline to x1,y1...close curveDescription   The close curve-command closes a sequence of lines, that has been drawn by   repeated line to-commands.Exampleopen window 200,200new curveline to 100,50line to 150,150line to 50,150close curve             This example draws a triangle: The three line to-commands draw two lines;   the final line is however not drawn explicitly, but drawn by the close   curve-command.See also   line, new curve     _________________________________________________________________Name   close printer - stops printing of graphicsSynopsisclose printerDescription   The close printer-command ends the printing graphics. Between open printer   and close printer everything you draw (e.g. circles, lines ...) is sent to   your printer. close printer puts an end to printing and will make your   printer eject the page.Exampleopen window 200,200open printercircle 100,100,50close printerclose window             As soon as close printer is executed, your printer will eject a page with a   circle on it.See also   open printer     _________________________________________________________________Name   close window - close the graphics-windowSynopsisclose windowDescription   The close window-command closes the graphics-window, i.e. it makes it   disappear from your screen. It includes an implicit close printer, if a   printer has been opened previously.Exampleopen window 200,200circle 100,100,50close window             This example will open a window, draw a circle and close the window again;   all this without any pause or delay, so the window will be closed before you   may regard the circle..See also   open window     _________________________________________________________________Name   color - change color for any subsequent drawing-commandSynopsiscolour red,green,bluecolour "red,green,blue"Description   Change the color, in which lines, dots, circles, rectangles or triangles are   drawn. The color-command accepts three numbers in the range 0 ... 255 (as in   the first line of the synopsis above). Those numbers specify the intensity   for the primary colors red, green and blue respectively. As an example   255,0,0 is red and 255,255,0 is yellow.   Alternatively you may specify the color with a single string (as in the   second line of the synopsis above); this string should contain three   numbers, separated by commas. As an example "255,0,255" would be violet.   Using this variant of the colour-command, you may use symbolic names for   colours:open window 100,100yellow$="255,255,0"color yellow$text 50,50,"Hallo"   , which reads much clearer.Exampleopen window 255,255for x=10 to 235 step 10:for y=10 to 235 step 10        colour x,y,0        fill rectangle x,y,x+10,y+10next y:next x             This fills the window with colored rectangles. However, none of the used   colours contains any shade of blue, because the color-command has always 0   as a third argument.See also   open window, backcolor, line, rectangle, triangle, circle     _________________________________________________________________Name   colour - see colorSynopsiscolour red,green,bluecolour "red,green,blue"See also   color     _________________________________________________________________Name   compile - compile a string with yabasic-code on the flySynopsiscompile(code$)Description   This is an advanced command (closely related with the execute-command). It   allows you to compile a string of yabasic-code (which is the only argument).   Afterwards the compiled code is a normal part of your program.   Note, that there is no way to remove the compiled code.Examplecompile("sub mysub(a):print a:end sub")mysub(2)             This example creates a function named mysub, which simply prints its single   argument.See also   execute     _________________________________________________________________Name   continue - start the next iteration of a for-, do-, repeat- or while-loopSynopsiscontinueDescription   You may use continue within any loop to start the next iteration   immediately. Depending on the type of the loop, the loop-condition will or   will not be checked. Especially: for- and while-loops will evaluate their   respective conditions, do- and repeat-loops will not.   Remark: Another way to change the flow of execution within a loop, is the   break-command.Examplefor a=1 to 100  if mod(a,2)=0 continue  print anext a             This example will print all odd numbers between 1 and 100.See also   for, do, repeat, while, break     _________________________________________________________________Name   cos() - return the cosine of its single argumentSynopsisx=cos(angle)Description   The cos-function expects an angle (in radian) and returns its cosine.Exampleprint cos(pi)             This example will print -1.See also   acos, sinD   data - introduces a list of data-items   date$ - returns a string with various components of the current date   dec() - convert a base 2 or base 16 number into decimal form   default - mark the default-branch within a switch-statement   dim - create an array prior to its first use   do - start a (conditionless) do-loop   doc - special comment, which might be retrieved by the program itself   docu$ - special array, containing the contents of all docu-statement within          the program   dot - draw a dot in the graphic-windowName   data - introduces a list of data-itemsSynopsisdata 9,"world"...read b,a$Description   The data-keyword introduces a list of comma-separated list of strings or   numbers, which may be retrieved with the read-command.   The data-command itself does nothing; it just stores data. A single   data-command may precede an arbitrarily long list of values, in which   strings or numbers may be mixed at will.   yabasic internally uses a data-pointer to keep track of the current location   within the data-list; this pointer may be reset with the restore-command.Exampledo  restore  for a=1 to 4    read num$,num    print num$,"=",num  next aloopdata "eleven",11,"twelve",12,"thirteen",13,"fourteen",14             This example just prints a series of lines eleven=11 up to fourteen=14 and   so on without end.   The restore-command ensures that the list of data-items is read from the   start with every iteration.See also   read, restore     _________________________________________________________________Name   date$ - returns a string with various components of the current dateSynopsisa$=date$Description   The date$-function (which must be called without parentheses; i.e. date$()   would be an error) returns a string containing various components of a date;   an example would be 4-05-27-2004-Thu-May. This string consists of various   fields separated by hyphens ("-"):     * The day within the week as a number in the range 0 (=Sunday) to 6       (=Saturday) (in the example above: 4, i.e. thursday).     * The month as a number in the range 1 (=January) to 12 (=December) (in       the example: 5 which stands for May).     * The day within the month as a number in the range 1 to 31 (in the       example: 27).     * The full, 4-digit year (in the example: 2004, which reminds me that I       should adjust the clock within my computer ...).     * The abbreviated name of the day within the week (Mon to Sun).     * The abbreviated name of the month (Jan to Dec).   Therefore the whole example above (4-05-27-2004-Thu-May) would read: day 4   in the week (counting from 0), May 27 in the year 2004, which is a Thursday   in May.   Note, that all fields within the string returned by date$ have a fixed with   (numbers are padded with zeroes); therefore it is easy to extract the   various fields of a date format with mid$.Examplerem   Two ways to print the same ...print mid$(date$,3,10)dim fields$(6)a=split(date$,fields$(),"-")print fields$(2),"-",fields$(3),"-",fields$(4)             This example shows two different techniques to extract components from the   value returned by date$. The mid$-function is the preferred way, but you   could just as well split the return-value of date$ at every "-" and store   the result within an array of strings.See also   time$     _________________________________________________________________Name   dec() - convert a base 2 or base 16 number into decimal formSynopsisa=dec(number$)a=dec(number$,base)Description   The dec-function takes the string-representation of a base-2 or base-16   (which is the default) number and converts it into a decimal number. The   optional second argument (base) might 

⌨️ 快捷键说明

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