Learn to Code via Tutorials on Repl.it!

← Back to all posts
Part 4 c# tutorial: A new string
Bunnytoes (158)

Welcome to part four, a new string, in today lesson you will learn 2 methods for putting a stored value into a you will also learn about some using statements

Thread.Sleep(3000);
You see that peice of code? well that makes the system sleep for a little. Well I did that by using the using System.Threading at the top, but if you don't want to put that at the front write System.Threading.Thread.Sleep() and put the number of miliseconds to rest into it
  Console.Write("You can also Console.Write instead of WriteLine to write stuff on the same like, like this ");
  Console.Write("Hello ");

and the out put is You can also Console.Write instead of WriteLine to write stuff on the same like, like this Hello

Well now to the actual lesson, we'll store a word like down below

  string word = Console.ReadLine();

I can exit out of the quotation marks and do a + and then the variable like this " + word

Or I can put a $ in front of the quotations and then put the variable in curly brackets like this {word}

Use Console.Clear(); to clear what is written so far, look

Other common using statements are using System.Collections and System.Text
you can also call code from another method

    CallingFrom();

   
  }
  public static void CallingFrom ()
{
Console.WriteLine("You can also create a method and call it from different functions, in unity you do this: void voidName () then do curly brackets and put the code in there but in replit you have to make it a public static void");

thats all for today and I'll see you next time