Oxygen Basic

Programming => Problems & Solutions => Topic started by: Peter on April 08, 2015, 10:43:52 AM

Title: Len Function
Post by: Peter on April 08, 2015, 10:43:52 AM
Deleted
Title: Re: Len Function
Post by: Charles Pegge on April 08, 2015, 12:32:11 PM
Peter,

countof cars will give you the static array count.

len cars is the same as len cars[0]

Code: OxygenBasic
  1. include "asm.inc"
  2. window 640,480,1
  3.  
  4. string cars = {"BMW","VOLVO","SAAB","FORD","OPEL","RENAULT","MERCEDES"}
  5.  
  6. for i=0 to < countof cars
  7.     text 10,i*12,10,cars[i]
  8. next
  9.  
  10. for i=0 to 6
  11.     text 90,i*12,10,cars[i]
  12. next
  13.  
  14. waitkey
  15. winExit
  16.  
Title: Re: Len Function
Post by: Aurel on April 08, 2015, 02:55:09 PM
Quote
countof was not known to me until now!
yes for me to.. ???
Title: Re: Len Function
Post by: Charles Pegge on April 08, 2015, 07:49:43 PM
There are a few more ofs, mostly used for diagnostics, returning numbers or strings.

Here is the current list:

sizeof
offsetof
countof / spanof
bytesof
typecodeof

typeof
structureof / encodingof
prototypeof
recordof



PS: plasma.exe works on my PC