jeudi 27 juin 2019

C# How to use if, else then [on hold]

I need to isolate a number between two parameters. How to use if, else (then?).

I have tried the statements, but get a whole lot of squiggly lines and do not know what to do next. In this case, let's use vert1dec only. The value of vert1dec is 93 degrees. if it is bigger than 90 degrees AND smaller than 120 degrees, the result should be: vert1dec - 90 degrees. Should vert1dec be smaller than 90 degrees, the result must be 90 degrees - vert1dec. I will appreciate any assistance.

      var vert1dec = Convert.ToDouble(Vert1Decimal.Text);
        var vert2dec = Convert.ToDouble(Vert2Decimal.Text);

        var sldist1 = Convert.ToDouble(SlDist1);
        var sldist2 = Convert.ToDouble(SlDist2);

       /*
         if vert1dec > 90 && < 120 then

                   {

                      vert1dec -90 

                   } else if

                    if vert1dec < 90 && then

                     {

                    90 - vert1dec

                    } else if

                   if vert1dec < 270 && > 120 then

                    {

                   270 - vert1dec

                   } else

                   if vert1dec > 270 then

                   {

                    vert1dec - 270

                   }
        */

The result should be as described in the query. Thank you in advance.

Aucun commentaire:

Enregistrer un commentaire