Saturday, April 26, 2025

C# - Arrays and Foreach Loop

using System;

namespace LearnCS
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] pLanguages = { "Perl", "Python", "Java", "JS", "C++", "C" };
            int[] numbers = { 1, 34, 25, 23442, 56, 56, 56, 100 };

            foreach (string i in pLanguages) {
                Console.WriteLine(i);
            }

            foreach (int x in numbers) {
                Console.WriteLine(x * 3);
            }

        }
    }        
}

 

No comments:

Post a Comment

Tkinter Introduction - Top Widget, Method, Button

First, let's make shure that our tkinter module is working ok with simple  for loop that will spawn 5 instances of blank Tk window .  ...