C# Tutorial #9: WHILE & DO-WHILE Loop | BREAK | Visual Studio | Filipino | Tagalog



Hey guys today we are going to talk about LOOP Statements specifically WHILE and DO WHILE Loop these statements are used to repeat a certain code block so we don’t have to type it over and over again.

C# Tutorial #9: WHILE & DO-WHILE Loop | BREAK | Visual Studio | Filipino | Tagalog

Language: C#
Series: C# Tutorial Tagalog

Timestamps
00:00 – Intro

2nd Channel
https://www.youtube.com/channel/UCrpgPZDwDehk4JUvYorp0Zg

Facebook Page
https://www.facebook.com/SDPTSolutionsOfficial/

Join SDPT Exclusive Members
https://www.youtube.com/channel/UCMDL68xgNqRqzin1rkh9WuQ/join

31 Comments

  1. using System;

    using System.Collections.Generic;

    using System.IO.Pipes;

    using System.Linq;

    using System.Text;

    using System.Threading.Tasks;

    namespace Tutorial9

    {

    internal class Program

    {

    static void Main(string[] args)

    {

    int lives = 3;

    int ans;

    while (lives != 0)

    {

    Console.Write("What is 1+1? ");

    ans = Convert.ToInt32(Console.ReadLine());

    lives–;

    if (ans != 2) Console.WriteLine("You only have " + lives + " try");

    else if (ans == 2)

    {

    Console.WriteLine("Your answer is correct!");

    break;

    }

    }

    }

    }

    }

  2. Console.WriteLine("Simple Question Game");

    Console.WriteLine("");

    bool ans = false;

    int life = 3;

    do {

    Console.WriteLine("What is 1+1?");

    int answer = Convert.ToInt32(Console.ReadLine());

    if (answer != 2)

    {

    life–;

    if (life == 0)

    {

    Console.WriteLine("Game Over!");

    break;

    }

    }

    else

    {

    Console.WriteLine("You are correct!");

    ans = true;

    }

    } while (ans == false);

  3. Nagtry akong gumamit ng char[ ] array na walang laman kasi gusto ko user ang maglalagay. but nong naglalagay na ko kahit pasok pa sya sa container; palagi syang array out of bound. Gusto ko sana magprint ng 5 letter word tapos irereverse ko yung spelling nya. pano kaya yun? hehehe

  4. mas maganda tagala pag may ARRAY nagiging maiksi
    int guide = 0;

    int lives = 3;

    string[] ques = {"What ","Who ","why "};

    string[] correctAnswer ={"jupiter","mars","venus"};

    string[] answer = new string[3];

    while (lives > 0)

    {

    Console.WriteLine("Life :" + lives);

    Console.WriteLine();

    Console.WriteLine(ques[guide]);

    Console.WriteLine();

    Console.Write("Answer : ");

    answer[guide] = Console.ReadLine();

    if (correctAnswer[guide].Equals(answer[guide])){

    Console.WriteLine("Correct! ");

    guide ++;

    }

    else lives –; guide ++;
    }

    Console.WriteLine();

    Console.WriteLine("You Lost");

    salamat sa turo mo idol

  5. anlayo ng code ko pero its work naman
    nag loop muna then if else for the correct and wrong answer yung game over naman nag if ako sa variable ng while
    nung nakilala ko tong channel lumawak logic ko ansarap na mag code

  6. if (month ==1 && day <=31)

    {

    switch (month)

    {

    case 1:

    Console.Write("January "); Console.Write(day + ", "); Console.Write(year);

    break;

    }

    }

    else if (month ==2 && day <=28)

    {

    switch (month)

    {

    case 2:

    Console.Write("Febuary "); Console.Write(day+", "); Console.Write(year);

    break;

    }

    }

    else if (month ==3 && day <=31)

    {

    switch (month)

    {

    case 3:

    Console.Write("March "); Console.Write(day + ", "); Console.Write(year);

    break;

    }

    }

    else if (month ==4 && day <=30)

    {

    switch (month)

    {

    case 4:

    Console.Write("April "); Console.Write(day + ", "); Console.Write(year);

    break;

    }

    }

    else if (month ==5 && day <=31)

    {

    switch (month)

    {

    case 5:

    Console.Write("May "); Console.Write(day + ", "); Console.Write(year);

    break;

    }

    }

    else if (month ==6 && day <=31)

    {

    switch (month)

    {

    case 6:

    Console.Write("June "); Console.Write(day + ", "); Console.Write(year);

    break;

    }

    }

    else if (month ==7 && day <=30)

    {

    switch (month)

    {

    case 7:

    Console.Write("July "); Console.Write(day + ", "); Console.Write(year);

    break;

    }

    }

    else if (month ==8 && day <=31)

    {

    switch (month)

    {

    case 8:

    Console.Write("August "); Console.Write(day + ", "); Console.Write(year);

    break;

    }

    }

    else if (month ==9 && day <=30)

    {

    switch (month)

    {

    case 9:

    Console.Write("September "); Console.Write(day + ", "); Console.Write(year);

    break;

    }

    }

    else if (month ==10 && day <=31)

    {

    switch (month)

    {

    case 10:

    Console.Write("October "); Console.Write(day + ", "); Console.Write(year);

    break;

    }

    }

    else if (month ==11 && day <=30)

    {

    switch (month)

    {

    case 11:

    Console.Write("November "); Console.Write(day + ", "); Console.Write(year);

    break;

    }

    }

    else if (month ==12 && day <=31)

    {

    switch (month)

    {

    case 12:

    Console.Write("December "); Console.Write(day + ", "); Console.Write(year);

    break;

    }

    }

    else

    {

    Console.WriteLine("Invalid");

    }

    ang haba ng akin hahahahaha, salamat po sa Tutorial, nag start po ako mag araw kahapon

  7. Hello po first time po sa channel niyo❤️ ganda po ng mga vids niyo❤️ pwede po ba gawa po kayo ng content na Kung paano gumawa ng password na loop na kapag na enter mo palang po ung true password dun palang po titigil using c# po thank you po Godbless ❤️

Leave a Reply

© 2023 53GB