Jump to content




Printing a variable


  • You cannot reply to this topic
5 replies to this topic

#1 icecube45

  • Members
  • 38 posts

Posted 10 November 2012 - 05:10 PM

Let's say I would like to have code print a variable, like for example
print("enter a name:")
name = read()
print(name "was your name")
could I just do that? or is there some other way I have to do it

#2 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 10 November 2012 - 05:11 PM

this belongs in the beta forum
and you have to concatenate the two things using the .. operator:
print(var.."something")


#3 icecube45

  • Members
  • 38 posts

Posted 10 November 2012 - 05:12 PM

Ok, thanks. Im using it in a script to lock my computer, sorry for wrong section. fairly new to forums

#4 Luanub

    Lua Nub

  • Members
  • 1,135 posts
  • LocationPortland OR

Posted 10 November 2012 - 05:13 PM

You dont have to concatenate it you can use a comma as well. And this is fine in ask-a-pro. I'm not sure what it has to do with beta??

print(var," Stuff")


#5 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 10 November 2012 - 05:25 PM

View Postluanub, on 10 November 2012 - 05:13 PM, said:

You dont have to concatenate it you can use a comma as well. And this is fine in ask-a-pro. I'm not sure what it has to do with beta??

print(var," Stuff")
that only works with the print command
if you plan on doing something like
thing=var,"stuff"
it wont work

#6 Luanub

    Lua Nub

  • Members
  • 1,135 posts
  • LocationPortland OR

Posted 10 November 2012 - 05:26 PM

Some functions work with the comma, others don't. This topic is about printing, which does work with a comma.





3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users