Valhalla Legends Forums Archive | .NET Platform | [C#] Question

AuthorMessageTime
Crypticflare
In the following code displayed:

[code]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();
   }
}

[/code]

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

[code]
("The statement above is not {0}.", noContent);
[/code]

The variable defined as noContent will be inserted into the "{0}" spot.
January 7, 2004, 2:14 AM
Grok
Did you compile and run it? :)
January 7, 2004, 11:15 AM
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!
January 7, 2004, 1:20 PM
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.
January 7, 2004, 5:36 PM
Adron
You're trying to let his childlike enthusiasm run out?
January 7, 2004, 6:00 PM
Grok
[quote author=Adron link=board=37;threadid=4626;start=0#msg38681 date=1073498456]
You're trying to let his childlike enthusiasm run out?
[/quote]

Haha, no, actually I'm trying to encourage use of said enthusiasm to turn into learning technique!
January 7, 2004, 6:21 PM
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 ;)
January 7, 2004, 6:36 PM
Newby
Yeah, me and Crypticflare are learning C# together and it's pretty fun. =]
January 7, 2004, 7:24 PM
Grok
[quote author=Adron link=board=37;threadid=4626;start=0#msg38692 date=1073500562]
Ah, I see. Let's see which happens. Sitting around saying "cool" doesn't sound like it'd be amusing after a short while ;)
[/quote]

He's apparently still saying "cool". :)
January 7, 2004, 9:21 PM
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.
January 8, 2004, 5:27 AM
Fr0z3N
[quote author=Newby link=board=37;threadid=4626;start=0#msg38701 date=1073503496]
Yeah, me and Crypticflare are learning C# together and it's pretty fun. =]
[/quote]

And me!
January 9, 2004, 11:10 PM

Search