3 years ago

Hey! More than half of Unity game development is spent on programming.

How well do you know C#? Let's check!

What will be output to the console when the Start() method is executed? Choose the answer below!

(Full code in the article)


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;
    }
}
		
	
  50 votes Voting finished



9 comments

Loading...

Next up

Introducing the voice acting team!

2 roles, 4 languages, 8 voice actors. So much work went into this - all to make your gameplay even better!

Links and contacts will be on the new game page that will be created soon

2025

Help wanted!

Translator (any language), Animator

More information in the article

Help wanted!

Animator

More information in the article

Happy Joltidays! A new quest has entered your quest log. Accept the quest and follow @therealkomasan to open today's slot on the calendar.

#AdventCalendar2025

Help wanted!

Translator (English -> Hindi)

More information in the article

Happy #WIPWednesday! Are you working on a game? Making some art? Practicing a song? Something else? Tell us in the comments!

Gameplay screenshots

Tutorial is an important part of almost any game.

The game has task system, marker system and voice explanation (with subtitles) - all to make it as clear and comfortable for the player to play the game

2025

Help wanted!

Voice actor (Spanish)

More information in the article

A new quest celebrating Dead Pets Unleashed just entered your quest log!

Dead Pets Unleashed is a rock feminist adventure where you play as a demon named Gordy (the bassist of the punk band Dead Pets.)

Play the #DeadPetsDemo now: https://bit.ly/deadpetsgj

Introducing the translation team!

9 languages, 7 translators and a huge amount of content to translate. I'm sure it's worth it!

Links and contacts will be on the new game page that will be created soon

2025