Menu

Casting other that word

Help
viscomjim
2016-08-04
2016-08-06
  • viscomjim

    viscomjim - 2016-08-04

    In the Help it shows casting in the variables section, ie...

    MyAverage = ([word]Value1 + Value2) / 2

    Can you use "integer" as casting also for calculations that may result in a less than zero number and is it done in the same manner like...

    Value = ([integer] Var1 - Var2)

    and I assume you would dim the variable Value as integer?

    Thanks!!!!

    Title should read other THAN word...

     

    Last edit: viscomjim 2016-08-04
  • Anobium

    Anobium - 2016-08-06

    Hi,

    I think what you are tryīng to do will work. My code would be as shown below. I do not think you need casting. Try and see the results.

     HSerPrint "Camping Moulin Neuf "
     dim IValue as Integer
    
     dim Var1, Var2 as Word
    
       Var1 = 10
       Var2 = 200
       IValue = Var1 - Var2
    
     HSerPrint IValue ' this prints -190
    

    Anobium​

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.