SampleScript.cs
using UnityEngine;
namespace Assets.Samples.Sample1
{
public class SampleScript : MonoBehaviour
{
private void Start()
{
int firstValue = 0;
for (int i = 0; i < 5; i++)
firstValue = PostfixIncrement(firstValue);
int secondValue = 0;
for (int i = 0; i < 5; i++)
secondValue = PrefixIncrement(secondValue);
print(quot;First value = {firstValue}, second value = {secondValue}");
}
private int PostfixIncrement(int value)
=> value++;
private int PrefixIncrement(int value)
=> ++value;
}
}
9 comments