• Welcome to Valhalla Legends Archive.
 

[C#] Question

Started by Crypticflare, January 06, 2004, 08:14 PM

Previous topic - Next topic

Crypticflare

In the following code displayed:

using System;

class Booleans
{
   public static void Main()
   {
      bool content = true;
      bool noContent = false;

      Console.WriteLine("It is {0} that C# Station provides C# programming language content.", content);
      Console.WriteLine("The statement above is not {0}.", noContent);
      Console.ReadLine();
   }
}



Am I correct that the "{0}" will show up when you want to insert a variable and such? I've just started reading up on it today, but I'm not sure why they use "{0}" instead of just calling the variable directly, perhaps its my lack of knowlege with C based material, could anyone elaborate for me please?

Much thanks!


[EDITED] Allright I've been looking at it more, and I'm thinking that the "{0}" will mean that the next parameter that passes is what will be inserted into that spot so like


("The statement above is not {0}.", noContent);


The variable defined as noContent will be inserted into the "{0}" spot.

Grok

Did you compile and run it?  :)

Crypticflare

Yes, but I tend to doublecheck myself too many times. Other then that I'm rather enjoying the C# work, I'm not really advanced yet, still learning the simple functions(arrays, loops) but it's still fun!

Grok

Write lots of code, even if just typing in other people's examples.  Imagine how you can change it, and guess what it'll do (don't think about it for more than a few seconds though).  Make the change, and see what happens.  Go "oooh ok that's cool".  Repeat.

Adron

You're trying to let his childlike enthusiasm run out?

Grok

Quote from: Adron on January 07, 2004, 12:00 PM
You're trying to let his childlike enthusiasm run out?

Haha, no, actually I'm trying to encourage use of said enthusiasm to turn into learning technique!

Adron

Ah, I see. Let's see which happens. Sitting around saying "cool" doesn't sound like it'd be amusing after a short while ;)

Newby

Yeah, me and Crypticflare are learning C# together and it's pretty fun. =]
- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

Grok

Quote from: Adron on January 07, 2004, 12:36 PM
Ah, I see. Let's see which happens. Sitting around saying "cool" doesn't sound like it'd be amusing after a short while ;)

He's apparently still saying "cool".  :)

Crypticflare

Cool.

Actually I've gotten pretty good so far at it, I've just come across a few problems concerning "methods" in my lesson chapter, it doesn't explain a lot about them, so I'm still stumbling around. Besides that, its the most addicting language I've written in for a while.

Fr0z3N

Quote from: Newby on January 07, 2004, 01:24 PM
Yeah, me and Crypticflare are learning C# together and it's pretty fun. =]

And me!