using System;
class Program{
static void Main()
{
for (int i = 0; i < 5; i++)
{
Console.Write($"Row {i}: ");
if (i < 3){
Console.WriteLine("Test");
continue;
}
Console.WriteLine("Continue");
}
}
}
Row 0: Test
Row 1: Test
Row 2: Test
Row 3: Continue
Row 4: Continue
using System;
class Program{
static int Sum(int a, int b){
return a + b;
}
static void Main()
{
Console.WriteLine($"Number after Sum : {Sum(55,12)}");
}
}
# Python program to show how to use a pass statement in a for loop
'''''คำสั่ง pass นั้นเป็นเหมือน placeholder. สามารถมาเติมข้อมูลใส่ภายหลังได้'''
sequence = {"Python", "Pass", "Statement", "Placeholder"}
for value in sequence:
if value == "Pass":
pass # ปล่อยบล็อกนี้ว่างไว้ ถ้าต้องการใช้ คำสั่ง pass
else:
print("Not reached pass keyword: ", value)
# ฟังก์ชั่นว่างเปล่า:
def empty():
pass
# คลาสว่างเปล่า
class Empty:
pass
Not reached pass keyword: Python
Not reached pass keyword: Placeholder
Not reached pass keyword: Statement