Posted 24 December 2012 - 04:46 AM
Concatenation- what it is and why do we need it
Con-cate-nati-on what a difficult word-what does it mean?
To put it short- concatenation is a way we can print out variables, do fs.something with the variables.
We need It to make our programs more flexible.
can you tell me more??
Yes I can, first things first- create a piece of code wich looks like this
this cleares the window, Makes a directory called testfiles and prints a command.
AND THEN it creates a local variable called dirname and it reads the value of it from user input
Lets now make a directory in testfiles with the name of the dir we just specified, add this to the end of the last code
This now makes a directory inside testfiles and names it with the name we typed in before, it then shows a sentence that also has that name inside it. The .. are neccesary before the variable and the variable must be outside of the "". All other fs api functions should work the same way, textutils and write aswell.
Hope this helped, if you see a mistake or want me to make another tut on something, feel free to say so in the comments below.
Kind regards, makerimages
Con-cate-nati-on what a difficult word-what does it mean?
To put it short- concatenation is a way we can print out variables, do fs.something with the variables.
We need It to make our programs more flexible.
can you tell me more??
Yes I can, first things first- create a piece of code wich looks like this
term.clear();
fs.makeDir("/testfiles");
print("Please enter a directory name:")
local dirname= read("")
this cleares the window, Makes a directory called testfiles and prints a command.
AND THEN it creates a local variable called dirname and it reads the value of it from user input
Lets now make a directory in testfiles with the name of the dir we just specified, add this to the end of the last code
fs.makeDir("/testfiles"..dirname)
print("made a dir and called it"..dirname)
This now makes a directory inside testfiles and names it with the name we typed in before, it then shows a sentence that also has that name inside it. The .. are neccesary before the variable and the variable must be outside of the "". All other fs api functions should work the same way, textutils and write aswell.
Hope this helped, if you see a mistake or want me to make another tut on something, feel free to say so in the comments below.
Kind regards, makerimages