1.11. C # if statement

发布时间 :2023-12-08 01:10:10 UTC      

One if a statement consists of a Boolean expression followed by one or more statements.

1.11.1. Grammar #

In C # if syntax of the statement:

if(boolean_expression)
{
   /* The statement to be executed if the Boolean expression is true */
}

If the Boolean expression is true , the code block within the if statement will be executed. If the Boolean expression is false , the first set of code (after closed parentheses) after the end of the if statement will be executed.

1.11.2. Flow chart #

Image0

1.11.3. Example #

using System;
namespace DecisionMaking
{

    class Program
    {
        static void Main(string[] args)
        {
            /* Definition of Local Variables */
            int a = 10;
            /* Check Boolean conditions using if statements */
            if (a < 20)
            {
                /* If the condition is true, output the following statement */
                Console.WriteLine("A less than 20");
            }
            Console.WriteLine("The value of a is {0}", a);
            Console.ReadLine();
        }
    }
}

When the above code is compiled and executed, it produces the following results:

A less than 20
The value of a is 10

Principles, Technologies, and Methods of Geographic Information Systems  102

In recent years, Geographic Information Systems (GIS) have undergone rapid development in both theoretical and practical dimensions. GIS has been widely applied for modeling and decision-making support across various fields such as urban management, regional planning, and environmental remediation, establishing geographic information as a vital component of the information era. The introduction of the “Digital Earth” concept has further accelerated the advancement of GIS, which serves as its technical foundation. Concurrently, scholars have been dedicated to theoretical research in areas like spatial cognition, spatial data uncertainty, and the formalization of spatial relationships. This reflects the dual nature of GIS as both an applied technology and an academic discipline, with the two aspects forming a mutually reinforcing cycle of progress.