CKTIS / C#
if: практическа справка
if: практическа справка: if изпълнява клон само когато условието bool е true.
Версия: C# language; verified against C# 14 reference
Синтаксис
if /* grammar-specific form */if изпълнява клон само когато условието bool е true.
Използвайте за локално решение, като изнесете сложните предикати в именувани функции.
C# не преобразува числа или обекти в bool; short-circuit остава в условието.
Без скоби само следващият оператор принадлежи на if; nullable не е bool.
Пълната програма действително използва if; точният очакван stdout е yes.
Примери
using System;
using System.Buffers;
using System.Collections.Concurrent;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
using Number = System.Int32;
if (2 < 3) Console.WriteLine("yes");
Резултат
yes
Пълната програма действително използва `if`; точният очакван stdout е `yes`.