Page 1 of 1
Help bad parameter
Posted: Tue Oct 25, 2005 7:57 pm
by Thorn
Hi! I'm PureBasic's newbie
I'm writing an easy example for calculate the age, but i have an error when try to compiling.
"Line 10:bad parameter type: a string is expected"
Code: Select all
OpenConsole()
Print("Your birth date: ")
birthday.s= Input()
age.w=Val("Right(Date() ,4)") - Val("Right(birthday.s ,4)")
Print("This year you have: ")
Print (age.w)
Print("years.")
End
CloseConsole()
Posted: Tue Oct 25, 2005 8:02 pm
by Straker
Try
Print(Str(age.w))
Posted: Tue Oct 25, 2005 8:05 pm
by Droopy
Print can only display Strings
Use STR to convert a value to String
Posted: Tue Oct 25, 2005 8:11 pm
by netmaestro
Thorn, you have many many problems with this code. I rewrote it so it actually works, now compare mine with yours:
Code: Select all
OpenConsole()
Print("Your birth date: ")
birthday.s= Input()
age.l=Val(Right(Str(Year(Date())) ,4)) - Val(Right(birthday.s ,4))
Print(" This year you have: ")
Print (Str(age))
Print(" years.")
Input()
CloseConsole()
End
Posted: Tue Oct 25, 2005 9:03 pm
by Thorn
Thanks folks!
Once i used Qbasic language, now i'm trying to convert Qb examples in to PureBasic code, and i have some problems.
Posted: Tue Oct 25, 2005 9:33 pm
by blueznl
gotta' promote myself a little

did you check the survival guide?
Posted: Tue Oct 25, 2005 9:39 pm
by netmaestro
This code reminds me of a scene from "Support your local Sheriff" where James Garner looks at a Sheriff's badge with a huge dent in it and says,
"It sure looks to have saved the life of whoever was wearing it!",
and Harry Morgan's reply was,
"Well it sure would've if it weren't for all them other bullets coming in from everywhere."
Welcome to the forum, Thorn and best of luck with your new language. I know you'll come to love it!
Posted: Wed Oct 26, 2005 12:21 am
by rsts
netmaestro wrote:This code reminds me of a scene from "Support your local Sheriff" where James Garner looks at a Sheriff's badge with a huge dent in it and says,
"It sure looks to have saved the life of whoever was wearing it!",
and Harry Morgan's reply was,
"Well it sure would've if it weren't for all them other bullets coming in from everywhere."
Welcome to the forum, Thorn and best of luck with your new language. I know you'll come to love it!
Wonderfully appropriate quote from a very funny movie.