π
<-

problem with # command

:32ti89: :32ti892: :32ti89t: :32ti89tn: :32ti92: :32tiv200:

problem with # command

Unread postby compsystems » 06 Feb 2015, 16:44

Hello, for the following program does not save the contents of variable id1. is a tibasic problema?, there is a ASM program that solves the problem.

Thanks

Code: Select all
test(cpyname,val)
Prgm
  Local temp
  ClrIO
  Disp "cpyname="&string(cpyname) © cpyname->id1
  Disp "val="&string(val) © val->50
  Disp "cpyname="&string(#(string(cpyname))) © cpyname->id1
  Pause

  Disp ""

  val→#(string(cpyname)) © cpyname->50 => id1->50
  Disp "cpyname="&string(#(string(cpyname))) © cpyname->val ???
  Disp "id1="&string(id1) © id1->50 ?????????
  Disp ""

  temp→#(string(cpyname)) © cpyname->temp
  val→temp

  Disp "cpyname="&string(#(string(cpyname)))
  Disp "id1="&string(id1)
  Disp ""

  Pause
  DispHome

EndPrgm


Entry Line steps

DelVar id1 [ENTER]
id1 [ENTER]
test(id1,"50") © 50→id1 [ENTER]
id1 [ENTER]
User avatar
compsystems
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Level up: 40.2%
 
Posts: 256
Joined: 30 May 2011, 13:44
Gender: Male
Calculator(s):
MyCalcs profile

Re: problem with # command

Unread postby Bisam » 17 Feb 2015, 08:03

If I understand your comments, it seems that at line :
Code: Select all
  val→#(string(cpyname)) © cpyname->50 => id1->50
the simplification before assignation is incomplete... which is common in a program.
Apparently, global variables remain unassigned when used in a program, unless you explicitly ask to use their value... the problem being HOW ?

You may solve (part of) the problem by using "expr" :
Code: Select all
expr(val & "→#(" & cpyname & ")")
User avatar
BisamAdmin
Niveau 15: CC (Chevalier des Calculatrices)
Niveau 15: CC (Chevalier des Calculatrices)
Level up: 69.6%
 
Posts: 5670
Joined: 11 Mar 2008, 00:00
Location: Lyon
Gender: Male
Calculator(s):
MyCalcs profile

Re: problem with # command

Unread postby compsystems » 22 Feb 2015, 01:18

solved, is required to enter the variable name as a string

Code: Select all
chekid(varstr,type,content)
Prgm
  © Check the argument variable identifier
  Local vartype
  getType(#varstr)→vartype
  If vartype≠type or vartype="NONE" Then
    content → #varstr
  EndIf
EndPrgm


sample

delvar id1 [ENTER]

chekid("id1","NUM",85) [ENTER]

How the identifier id1 no contains a value, is assigned 85 to id1.

id1 = 85

now

chekid("id1","STR","hello") [ENTER]

How the identifier id1 contains a incorrect data type, reassigned a new value.

id1 = "hello"
User avatar
compsystems
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Level up: 40.2%
 
Posts: 256
Joined: 30 May 2011, 13:44
Gender: Male
Calculator(s):
MyCalcs profile


Return to Problèmes divers / Aide débutants

Who is online

Users browsing this forum: ClaudeBot [spider] and 3 guests

-
Search
-
Social TI-Planet
-
Featured topics
Comparaisons des meilleurs prix pour acheter sa calculatrice !
"1 calculatrice pour tous", le programme solidaire de Texas Instruments. Reçois gratuitement et sans aucune obligation d'achat, 5 calculatrices couleur programmables en Python à donner aux élèves les plus nécessiteux de ton lycée. Tu peux recevoir au choix 5 TI-82 Advanced Edition Python ou bien 5 TI-83 Premium CE Edition Python.
Enseignant(e), reçois gratuitement 1 exemplaire de test de la TI-82 Advanced Edition Python. À demander d'ici le 31 décembre 2024.
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
1234
-
Donations / Premium
For more contests, prizes, reviews, helping us pay the server and domains...
Donate
Discover the the advantages of a donor account !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partner and ad
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
761 utilisateurs:
>750 invités
>4 membres
>7 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Other interesting websites
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)