String
Part of the Fundamentals section of Coddy's C# journey — lesson 7 of 69.
The string type is a special type that consists of multiple chars.
To initialize a string value in a variable, enclose it within double quotation marks:
string s1 = "This is a string";In the above example, a string variable named s1 is initialized.
Challenge
BeginnerStore the string I am learning to code with Coddy! in a variable named coddy.
Be sure to store the exact string value with correct casing.
Cheat sheet
The string type consists of multiple characters. To initialize a string variable, enclose the value within double quotation marks:
string s1 = "This is a string";Try it yourself
using System;
public class Program {
public static void Main(string[] args) {
// Type your code below
string coddy = ?
// Don't change the line below
Console.WriteLine("coddy = " + coddy);
}
}This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Fundamentals
4Operators Part 1
Arithmetic OperatorsModulo OperatorIncrement/DecrementPost Increment/DecrementArithmetic Shortcuts5Operators Part 2
Comparison OperatorsLogical Operators Part 1Logical Operators Part 2Recap - Simple LogicLogical Operators Part 3