input trouble

BlitzPlus Forums/BlitzPlus Programming/input trouble

yomaeister(Posted 2009) [#1]
every time i try to do that i get a 0 when it says "hello "
+ cashier\name.

exact code :
type cashier
field name
end type

cashier/name = input$ "Please enter your name "


Matty(Posted 2009) [#2]
name has to be a string variable.
Change "field name" to "field name$"


blackgecko(Posted 2009) [#3]
And add brackets to Input, because it's a function and all functions must have brackets:
cashier/name$ = input$("Please enter your name ")



schilcote(Posted 2009) [#4]
Which brings up a question I've always had: Why dosn't Print need brackets?


Matty(Posted 2009) [#5]
Functions don't need brackets if they are not going to return a value into a variable in blitz.

For example:

readpixel x,y

will compile

as will

readpixel (x,y)

but

col = readpixel x,y

will not compile

while

col = readpixel(x,y)

will compile.


blackgecko(Posted 2009) [#6]
Right, functions need brackets, if you want them to return something.