Quotes help make search much faster. Example: "Practice Makes Perfect"

Tuesday, September 3, 2019

Codecademy Optional Parameters 8/10


// Sample Solution
using System;

namespace NamedArguments
{
  class Program
  {
    static void Main(string[] args)
    {
VisitPlanets(numberOfPlanets: 2, name: "Nathan");
    }
   
    static void VisitPlanets(
      string adjective = "brave",
      string name = "Cosmonaut",
      int numberOfPlanets = 0,
      double gForce = 4.2)
    {
      Console.WriteLine($"Welcome back, {adjective} {name}.");
      Console.WriteLine($"You visited {numberOfPlanets} new planets...");
      Console.WriteLine($"...while experiencing a g-force of {gForce} g!");
    }
  }
}

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts