Valhalla Legends Archive

Programming => General Programming => .NET Platform => Topic started by: Crypticflare on January 06, 2004, 08:14 PM

Title: [C#] Question
Post by: Crypticflare on January 06, 2004, 08:14 PM
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.
Title: Re:[C#] Question
Post by: Grok on January 07, 2004, 05:15 AM
Did you compile and run it?  :)
Title: Re:[C#] Question
Post by: Crypticflare on January 07, 2004, 07:20 AM
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!
Title: Re:[C#] Question
Post by: Grok on January 07, 2004, 11:36 AM
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.
Title: Re:[C#] Question
Post by: Adron on January 07, 2004, 12:00 PM
You're trying to let his childlike enthusiasm run out?
Title: Re:[C#] Question
Post by: Grok on January 07, 2004, 12:21 PM
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!
Title: Re:[C#] Question
Post by: 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 ;)
Title: Re:[C#] Question
Post by: Newby on January 07, 2004, 01:24 PM
Yeah, me and Crypticflare are learning C# together and it's pretty fun. =]
Title: Re:[C#] Question
Post by: Grok on January 07, 2004, 03:21 PM
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".  :)
Title: Re:[C#] Question
Post by: Crypticflare on January 07, 2004, 11:27 PM
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.
Title: Re:[C#] Question
Post by: Fr0z3N on January 09, 2004, 05:10 PM
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!