From the course: Grasshopper and Rhino: C# Scripting
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Strings
- [Instructor] Strings allow us to display and store information as letters and words. A string data type is essentially then text. It is made up of characters, which form the complete string object. Let's create some strings using C#. Go ahead and place a new C# component and open it up. We can create strings by first declaring a string variable and assigning to it a value with either single or double quotation marks surrounding it, but not a combination. Let's try this by creating a variable named word, and we'll assign to this the string, Hello Grasshopper, and then let's output that word variable. Perfect, so we have our first string output with C#. We can perform arithmetic operations on strings too, such as addition. Addition is used to join strings together and is also known as concatenation. This is done using the plus symbol. For example, let's output A equals word plus from C#, and then see what we get. Great,…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Commenting2m 27s
-
Variables5m 1s
-
Numbers6m 36s
-
Strings5m 37s
-
Collections5m 34s
-
Arrays5m 32s
-
Comparing with operators5m 3s
-
Conditionals3m 30s
-
Logical operators6m 26s
-
Looping with the for loop5m 23s
-
Foreach looping4m 29s
-
Nested loops5m 12s
-
Methods6m 5s
-
Reference vs. value types5m 21s
-
Try and catch4m 14s
-
-
-