Word
 

      Word is not actually a command. It's a keyword used to declare an item as being Word data type. Namely used with Types




FACTS:


      * Word values are 16bit and have a numeric range of 0 to 65535

      * Word can only be used with Pointers & Type Fields in PlayBASIC V1.64 and bellow, there is no support for Word sized variables at this time.





Mini Tutorial:


      This example shows some valid usages of Word today.

  
; Declare a Word Pointer (a pointer to read/write Word values)
  Dim MyPointer As Word Pointer
  
; Create a bank
  CreateBank 1,100
  
; Get the address of this bank and store it in MyPointer
  MyPointer=GetBankPtr(1)
  
; Use this pointer to write some word values to a bank
  For lp=0 To 10
     *MyPointer=30000+lp
     MyPointer=MyPointer+1
  Next
  
; Get the address of this bank and store it in MyPointer again
  MyPointer=GetBankPtr(1)
  
; Use this pointer to read the values back
  For lp=0 To 10
     Print *(MyPointer+lp)
  Next
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  
  
  
  




This example would output.

  
  30000
  30001
  30002
  30003
  30004
  30005
  30006
  30007
  30008
  30009
  30010
  

 
Related Info: Byte | Dim | Float | Global | Integer | Local | Static | Type :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com