Beginner Question
- Posted by Rich Klender <rklender at e?cite.c?m> Jul 24, 2007
- 483 views
Hello all! I was fooling around with some simple concepts and cannot get the following to print out correctly (in the Dos window, I'm using Winxp).
with trace trace(1) atom a sequence Var1, Var2, Var3 Var1 = "apple" Var2 = "orange" Var3 = "File" printf(1, "Var1 equals: %s\n", {Var1}) printf(1, "Var2 equals: %s\n", {Var2}) Var3 = append(Var3, Var1) printf(1, "Var3 after append equals: %s\n", Var3) printf(1, "Var31 after append equals: %s\n", Var3[1]) printf(1, "Var32 after append equals: %s\n", Var3[2]) Var3 = prepend(Var3, Var2) printf(1, "Var3 after prepend equals: %s\n", Var3) a=getc(0) trace(0)
This 1st printf's work fine, the next one where Var3 is printed out after the append gives "F", the 1st letter of "File". The next printf gives "F" again, the next gives "i", the last "orange". When running trace, the variables are assigned correctly, i.e. Var3 gives "appleFile" then "appleFileorange". What am I doing wrong? Also, in the Euphoria Reference Manual, under printf, it states when using printf to watch out for: printf(1, "%s", name) and to use {name} instead. However, this always gives a error when I tried it on Var3, taking these out, the program ran fine, well, almost fine, other then it's not outputting correctly!! Any help would be appreciated!! Thanks Rich