Thread: Hello world
View Single Post
  #1 (permalink)  
Old 11-15-2007, 12:50 PM
MrPickle's Avatar
MrPickle MrPickle is offline
Sr. Programmer
Join Date: Nov 2007
Location: England, Lincolnshire
Posts: 303
iTrader: (0)
MrPickle is on a distinguished roadMrPickle is on a distinguished roadMrPickle is on a distinguished road
Hello world

Sorry if this is the wrong place.

Open notepad and type or copy & paste this into it:

Code:
function helloWorld(){ //function is telling us that this is a new function and helloWorld is the name of the function.
// "//" is a comment.
// { is to open our function.
echo("Hello World!"); // echo prints things into our console anything within the brackets is echoed.
//" " is a tagged field, you don't need these is you're echoing a number, one word or an equation.
} //close the function.
Now save it wherever you put your torque folder as a .cs file.

Fire up torque.

Now you'll need to exec it bye typing this into the console (` or ~)
Code:
exec("filepath.cs");
Now type "helloWorld();" into the console, it should print Hello World!

Now for a more complicated one.

Code:
function hello(%arg1, %arg2){ //function again to say this is a new function.
// hello is the name of our function.
// %arg1 and %arg2 are both local variables, they input what we want to say.
echo(%arg1 SPC %arg2); //our echo function again.
// "%arg1 SPC %arg2" If %arg1's string were to equal "Hello" and %arg2 were equal "World" this would Echo "Hello World" SPC add's a space inbetween our 2 strings.
} //close the function
Exec it (exec("filepath.cs"); ) then type into console (` or ~) hello("Hello", "World"); it should print Hello World, you can type input anything: hello("Dog", "cat"); hello("Apple", "banana");

If anything's unclear or you're stuck with anything feel free to ask/tell me.

__________________
PM me and tell me your name or a phrase and I shall write it in Elf for you. English Tengwar to be precise.
Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
The Following User Says Thank You to MrPickle For This Useful Post:
HelloWorld (11-15-2007)