baseConvert help

Ken Ray kray at sonsothunder.com
Fri Jan 28 00:12:35 EST 2005


On 1/27/05 9:26 PM, "Paul Salyers" <ps1 at softseven.org> wrote:

> 
> 
> I'm converting a hexadecimal number to decimal. the below code works and
> placed it in my label called myNumber
> 
>    put baseConvert(tmpVar,16,10) into field myNumber
> 
> The problem is I now need to use myNumber to do some calculations with and
> place it in a field called myAnswer

Do you need to put it initially into the MyNumber field? How about just put
it into a variable? Like:

  put baseConvert(tmpVar,16,10) into tNumber
  put tNumber into fld "myNumber"
  put tNumber * 10 into fld "myAnswer"

BTW: I would STRONGLY suggest you put the names of your objects in quotes.
Rev is good about letting that slide as long as it can understand what you
mean, but you may get unexpected results if you use the same name for a
field that you do for a variable. For example, what should Rev do when it
encounters:

  put 10 into myNumber
  put myNumber into fld myNumber

However this is clear:

  put 10 into myNumber
  put myNumber into fld "myNumber"

HTH,

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list