1. Variable declaration versus assignment
- Posted by David Alan Gay <moggie at INTERLOG.COM> Feb 09, 1997
- 1190 views
> To David Alan Gay: > I am running the gt1 and gt2 outside the program.Could that be the problem? Nope. That's not the problem, because I ran GT1.EX and GT2.EX outside the tutorial. They are designed to be run separately from the tutorial. These programs scan for the available and unavailable video modes on your card. > also I was studying your program about atoms,seq.The problem I am having is > that when I try to declare a varable it keeps telling me that I am > wrong(e.g. c = c + 1) When I try to declare C I write atom c --It tells > me this is wrong so I try object c or integer c--but those are wrong too.I > have reread the frist part over again and looked in the manual and I can,t > see anything wrong HELP? Of course, I will try to help :) First of all, declaring a variable does not involve assigning a value for it. It's telling Euphoria a) what name it is, and b) what type it is. I hope you are not trying to assign a value to c when you are declaring it. That is a no-no. Here is an program using your atom c variable as an example: atom c c = 50 c = c + 1 print(1,c) puts(1,'\n') Pretty easy stuff. First declare C as an atom, then assign a value to it. Euphoria hates it when you try to use uninitialized variables in a calculation. This program will output a value of 51. The following puts() is just to do a linefeed. > P.S. When I say I have "reread the frist part over again" I mean that I > have printed your data.doc out on my printer I find that it works good as a > refrence when I am try write a program.Hope that is ok! please tell me if > it is not. It's okay. I tell people to do that when they want a hardcopy to take to school or work with them instead of lugging the whole software with them. Hope this helps. If not, write here again and we will try to help again. :) David Gay http://www.interlog.com/~moggie/Euphoria "A Beginner's Guide To Euphoria"