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

📄 yabasic.1

📁 Linux下VB解释器
💻 1
📖 第 1 页 / 共 5 页
字号:
   the file. This is simply done by putting a hash ('#') followed by the number   of the file after the keyword input (for reading from) or print (for writing   to a file) respectively.   If you need more control, you may consider reading and writing one byte at a   time, using the multi-purpose commands peek and poke.Subroutines and Libraries   The best way to break any yabasic-program into smaller, more manageable   chunks are subroutines and libraries. They are yabasic's most advanced means   of structuring a program.   Subroutines are created with the command sub. they accept parameters and may   return a value. Subroutines can be called much like any builtin function of   yabasic; therefore they allow to extend the language itself.   Once you have created a set of related subroutines and you feel that they   could be useful in other programs too, you may collect them into a library.   Such a library is contained within a separate file and may be included in   any of your programs, using the keyword import.String processing   yabasic has the usual functions to extract parts from a string: left$, mid$   and right$. Note, that all of them can be assigned to, i.e. they may change   part of a string.   If you want to split a string into tokens you should use the functions token   or split.   There is quite a bunch of other string-processing functions like upper$   (converting to upper case), instr (finding one string within the other),   chr$ (converting an ascii-code into a character), glob (testing a string   against a pattern) and more. Just follow the links.Arithmetic   Yabasic handles numbers and arithmetic: You may calculate trigonometric   functions like sin or atan, or logarithms (with log). Bitwise operations,   like and or or are available as well min or max (calculate the minimum or   maximum of its argument) or mod or int (reminder of a division or integer   part or a number).Data and such   You may store data within your program within data-statements; during   execution you will probably want to read it into arrays, which must have   been dimed before.Other interesting commands.     * Yabasic programs may start other programs with the commands system and       system$.     * peek and poke allow to get and set internal information; either for the       operating system (i.e. Unix or Windows) or yabasic itself.     * The current time or date can be retrieved with (guess what !) time$ and       date$.Chapter 5. All commands and functions of yabasic listed by topic   Number processing and conversion   Conditions and control structures   Data keeping and processing   String processing   File operations and printing   Subroutines and libraries   Other commands   Graphics and printingNumber processing and conversion   abs()          returns the absolute value of its numeric argument   acos()          returns the arcus cosine of its numeric argument   and()          the bitwise arithmetic and   asin()          returns the arcus sine of its numeric argument   atan()          returns the arctangent of its numeric argument   bin$()          converts a number into a sequence of binary digits   cos()          return the cosine of its single argument   dec()          convert a base 2 or base 16 number into decimal form   eor()          compute the bitwise exclusive or of its two arguments   euler          another name for the constant 2.71828182864   exp()          compute the exponential function of its single argument   frac()          return the fractional part of its numeric argument   int()          return the integer part of its single numeric argument   log()          compute the natural logarithm   max()          return the larger of its two arguments   min()          return the smaller of its two arguments   mod()          compute the remainder of a division   or()          arithmetic or, used for bit-operations   pi          a constant with the value 3.14159   ran()          return a random number   sig()          return the sign of its argument   sin()          return the sine of its single argument   sqr()          compute the square of its argument   sqrt()          compute the square root of its argument   tan()          return the tangent of its argument   xor()          compute the exclusive or   ** or ^          raise its first argument to the power of its secondConditions and control structures   and          logical and, used in conditions   break          breaks out of a switch statement or a loop   case          mark the different cases within a switch-statement   continue          start the next iteration of a for-, do-, repeat- or while-loop   default          mark the default-branch within a switch-statement   do          start a (conditionless) do-loop   else          mark an alternative within an if-statement   elsif          starts an alternate condition within an if-statement   end          terminate your program   endif          ends an if-statement   false          a constant with the value of 0   fi          another name for endif   for          starts a for-loop   gosub          continue execution at another point within your program (and return          later)   goto          continue execution at another point within your program (and never          come back)   if          evaluate a condition and execute statements or not, depending on the          result   label          mark a specific location within your program for goto, gosub or          restore   loop          marks the end of an infinite loop   next          mark the end of a for loop   not          negate an expression; can be written as !   on gosub          jump to one of multiple gosub-targets   on goto          jump to one of many goto-targets   on interrupt          change reaction on keyboard interrupts   logical or          logical or, used in conditions   pause          pause, sleep, wait for the specified number of seconds   repeat          start a repeat-loop   return          return from a subroutine or a gosub   sleep          pause, sleep, wait for the specified number of seconds   switch          select one of many alternatives depending on a value   then          tell the long from the short form of the if-statement   true          a constant with the value of 1   until          end a repeat-loop   wait          pause, sleep, wait for the specified number of seconds   wend          end a while-loop   while          start a while-loop   :          separate commands from each otherData keeping and processing   arraydim()          returns the dimension of the array, which is passed as an array          reference   arraysize()          returns the size of a dimension of an array   data          introduces a list of data-items   dim          create an array prior to its first use   read          read data from data-statements   redim          create an array prior to its first use. A synonym for dim   restore          reposition the data-pointerString processing   asc()          accepts a string and returns the position of its first character          within the ascii charset   chr$()          accepts a number and returns the character at this position within          the ascii charset   glob()          check if a string matches a simple pattern   hex$()          convert a number into hexadecimal   instr()          searches its second argument within the first; returns its position          if found   left$()          return (or change) left end of a string   len()          return the length of a string   lower$()          convert a string to lower case   ltrim$()          trim spaces at the left end of a string   mid$()          return (or change) characters from within a string   right$()          return (or change) the right end of a string   split()          split a string into many strings   str$()          convert a number into a string   token()          split a string into multiple strings   trim$()          remove leading and trailing spaces from its argument   upper$()          convert a string to upper case   val()          converts a string to a numberFile operations and printing   at()          can be used in the print-command to place the output at a specified          position   beep          ring the bell within your computer; a synonym for bell   bell          ring the bell within your computer (just as beep)   clear screen          erases the text window   close          close a file, which has been opened before   close printer          stops printing of graphics   print color          print with color   print colour          see print color   eof          check, if an open file contains data   getscreen$()          returns a string representing a rectangular section of the text          terminal   inkey$          wait, until a key is pressed   input          read input from the user (or from a file) and assign it to a variable   line input          read in a whole line of text and assign it to a variable   open          open a file   open printer          open printer for printing graphics   print          Write to terminal or file   putscreen          draw a rectangle of characters into the text terminal   reverse          print reverse (background and foreground colors exchanged)   screen          as clear screen clears the text window   seek()          change the position within an open file   tell          get the current position within an open file   using          Specify the format for printing a number   #          either a comment or a marker for a file-number   @          synonymous to at   ;          suppress the implicit newline after a print-statementSubroutines and libraries   end sub          ends a subroutine definition   export          mark a function as globally visible   import          import a library   local          mark a variable as local to a subroutine   numparams          return the number of parameters, that have been passed to a          subroutine   return          return from a subroutine or a gosub   static          preserves the value of a variable between calls to a subroutine   step          specifies the increment step in a for-loop   sub          declare a user defined subroutineOther commands   bind()          Binds a yabasic-program and the yabasic-interpreter together into a          standalone program.   compile          compile a string with yabasic-code on the fly   date$          returns a string with various components of the current date   doc          special comment, which might be retrieved by the program itself   docu$          special array, containing the contents of all docu-statement within          the program   error          raise an error and terminate your program   execute$()          execute a user defined subroutine, which must return a string

⌨️ 快捷键说明

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