-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCondition.cs
More file actions
50 lines (44 loc) · 833 Bytes
/
Condition.cs
File metadata and controls
50 lines (44 loc) · 833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
public class Condition
{
public static void Main()
{
/* IF */
// IF simples (Apenas exemplo)
if(true)/* Condição booleana */
{
// Se a condição for verdadeira.
}
// Multiplos IFs com ELSE (Apenas exemplo)
if(true)
{
}
else if(true)
{
}
else
{
// Caso nenhuma condição dos IFs for verdadeira
}
// IF ternário
string v_ou_f =
1 + 1 == 2 /* Condição */
? "Verdadeiro" /* Caso true */
: "Falso" /* Caso false */
;
/* SWITCH */
int number = 1;
switch(number)
{
case 1:
Console.WriteLine("Number 1");
break;
case 2:
Console.WriteLine("Number 2");
break;
default:
Console.WriteLine("Default");
break;
}
}
}