Reply to topic

Kturtle: How to get a numerical value from "ask"?

alazar
Registered Member
Posts
3
Karma
0
OS
The following example is from Kturtle Handbook:

Code: Select all
$in = ask "What is your year of birth?"
$out = 2003 - $in
print "In 2003 you were " + $out + " years old at some point."


It results in the error message: "You tried to subtract a non-number, $in"

All my trials with "ask" ended with something similar, it seems it only can handle a string.
In the watch window a previously used numerical variable turns to string immediately after used with "ask".

Is there a workaround for this problem?
lueck
Mentor
Posts
225
Karma
2
I need no workaround with KTurtle Version 0.8 beta, KDE 4.3.3, it just works with your code example
alazar
Registered Member
Posts
3
Karma
0
OS
Thanks for your reply, I will check the version number.
alazar
Registered Member
Posts
3
Karma
0
OS
Updating to the new version fixed the problem. Thanks again for your comment.

 
Reply to topic

Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot], Gregstrq, grosser, magkoc, martinknopp, mirass, mrvldmr, mutterhunt, orcuan, Sogou [Bot], Yahoo [Bot]