string + string doesnt work??

BlitzMax Forums/BlitzMax Programming/string + string doesnt work??

ckob(Posted 2006) [#1]
Hmm i could of swore i've done this before but it's telling me '+' can only be used in numeric types.

WriteLine Design,"<p><b><font size=" + Chr(34) + "6" + Chr(34) + ">" + ProjctNametxt + "</font></b></p>"


Eikon(Posted 2006) [#2]
tmp = WriteFile("hey.txt")
WriteLine tmp, "<p><b><font size=" + Chr(34) + "6" + Chr(34) + ">" + "myproject" + "</font></b></p>" 
CloseFile tmp
works for me with 1.22.


ziggy(Posted 2006) [#3]
It seems you're not using superstrict, and the variable ProjctNametxt (as it is not well written) is created as a Integer. That could explain why BlitzMax tells it is not possible to sum a number and a string.
(just a possibility)
:D


TomToad(Posted 2006) [#4]
@ziggy: nope
Local MyInt:Int
Local MyString:String

MyInt = 42
MyString = "The Answer to Life, the Universe, and Everything is " + MyInt
Print MyString

BlitzMAX just converts the Int to a String and appends. Works even in SuperStrict mode.
But I do bet that ProjctNameTxt is the problem.

@ckob: What is the error exactly that you are getting?


SpaceAce(Posted 2006) [#5]
Ckob,
There's something else going on in your code. That line works perfectly with no alteration when I compile it with BlitzMax 1.22. I've also tried all kinds of silly things to trip it up, but nothing works.

ProjctNametxt isn't a function or a method, is it?

SpaceAce


Dreamora(Posted 2006) [#6]
The "numeric type" error often appears if you use objects and do not do .toString() to make sure they are a addable type ...