Syn Error
#1
Posted 05 September 2004 - 10:11 AM
"insert a charge"
?->Q
If Q = "0" Then "0 is not a valid number"
what?s i have bad in mi sample code?
#2
Posted 05 September 2004 - 10:18 AM
here is the working version:
"insert a charge"
?->Q
If Q = "0"
Then "0 is not a valid number"
see? nothing majorly wrong, just a little syntax error
PS: if you need electronics programs, check http://www.casiofortissimo.co.nr
#3
Posted 05 September 2004 - 10:25 AM
#4
Posted 05 September 2004 - 10:40 AM
#5
Posted 05 September 2004 - 10:42 AM
#6
Posted 05 September 2004 - 10:48 AM
"Ingrese la primera carga"
?->Q
If Q = 0
Then "Error"
i use this code and this not work...... look I respect the spaces on the code of top but this code .... i am very newie and i dont anything...
#7
Posted 05 September 2004 - 11:02 AM
but can i goto the Q declaration variable if Q is 0??????
If Q=0
Then "Error"
Goto ????
???? = function to resolve my problem... i use the Gp casio com... i downloaded 2 minutes ago...
#8
Posted 05 September 2004 - 11:16 AM
#9
Posted 05 September 2004 - 11:24 AM
I rapair the code , but i have new one!!!!!
but can i goto the Q declaration variable if Q is 0??????
If Q=0
Then "Error"
Goto ????
Hmm.. shouldn't it look like this:
If Q=0
Then "Error"
IfEnd
And if You use Goto, You'll have to place a label, like:
lbl Q
or
lbl 1
somewhere in the program. For labels You can use only one digit or character (A to Z, r, theta)
Note that lbl Q has nothing to do with variable Q - label marks a spot in program where You want to jump. So for example, if You assigned 1 to variable Q, Goto Q command won't take You to lbl 1, but to lbl Q. If lbl Q doesn't exist, You'll get a "jump error" message. It's like with lists or pictures - You can't recall a picture or list using variables, only numbers.
One more advice - if You write a program where You use many conditions (If) or lops (while, for), always close them, eg. when You open a loop using While, immidietely close it using WhileEnd. Do the same with for using next and with If using Ifend. Else You'll get a syntax error at the end of the program and it might be very hard to find a loop You left open...
#10
Posted 05 September 2004 - 11:54 AM
"INGRESE LA 1 CARGA"
?->Q
If Q=0
Then Goto 2
Lbl 2 "LA CARGA NO PUEDE SER CERO"
Goto 1
Else Goto 3
Lbl 3 "INGRESE LA 2 CARGA"
?->R
If R=0
Then Goto 4
Lbl 4 "LA CARGA NO PUEDE SER CERO"
Goto 3
Else Goto 5
Lbl 5 "INGRESE LA DISTANCIA"
?->D
If D=0
Then Goto 6
Lbl 6 "LA DISTANCIA NO PUEDE SER CERO"
Goto 5
Else Goto 7
Lbl 7 ((QXR)/D^2)->T
T_
END
WHERE
/ = divition
_ = show triangle
this work in the casiocom, but in my calc show an error .. say go ERROR
#11
Posted 05 September 2004 - 12:28 PM
Please please please don't use goto like that
Do "INGRESE LA 1 CARGA" ?->Q Q=0=>"LA CARGA NO PUEDE SER CERO" LpWhile Q=0 Do "INGRESE LA 2 CARGA" ?->R R=0=>"LA CARGA NO PUEDE SER CERO" LpWhile R=0 Do "INGRESE LA DISTANCIA " ?->D D=0=>"LA DISTANCIA NO PUEDE SER CERO" LpWhile D=0 ((QXR)/D^2)->T T_
Please forget Gotos for now, there are other instructions quite more efficient for this...
#12
Posted 05 September 2004 - 05:27 PM
you can not jump arround in If statments since somewhen there
will be a if end missing.
Also you don't need a goto if you just want to go on in the next line
#13
Posted 05 September 2004 - 05:40 PM
#14
Posted 06 September 2004 - 07:33 PM
Yes and goto == (unreadable programs, bugged programs, bad programs)
Exactly, but sometimes inevetible
#15
Posted 08 September 2004 - 03:40 PM
#16
Posted 08 September 2004 - 03:46 PM
0->A Lbl 0 Isz A //code A=10=>Goto 1 A<10=>Goto 0 Lbl 1
hehe, then i learnt about For loops
#17
Posted 08 September 2004 - 04:16 PM
for 1-> A To 10 Next
#18
Posted 08 September 2004 - 10:19 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users