Author Topic: ( and { characters  (Read 666 times)

Hi, I've been wanting to code in Torque, so I am viewing the tutorial, there are two characters I'm a bit confused about what they do, here is an example from the tutorial:

Code: [Select]
function helloWorld()
{
echo("Hello World");
}

I was wondering why you need '()' after the 'helloWorld' since you are naming a function, and also, could you tell me why you put '{}' around the object you wish to echo?

Thanks!

If the function has arguments, between the parenthesis is where you put them. They're kept for functions that don't have any arguments... well, because, really. I don't know why

Curly brackets mark the beginning and ends of blocks (functions, ifs, loops, etc) to tell the interpreter "this is where it starts and this is where it ends"

To clarify, anything inside those function brackets are the code that runs whenever that function is executed.

If the function has arguments, between the parenthesis is where you put them. They're kept for functions that don't have any arguments... well, because, really. I don't know why

Curly brackets mark the beginning and ends of blocks (functions, ifs, loops, etc) to tell the interpreter "this is where it starts and this is where it ends"

To clarify, anything inside those function brackets are the code that runs whenever that function is executed.
Thank you both!