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

Trophies reveal

Some trophies will be easy to unlock, and some will be quite a challenge

2025

Next game feature - Statistics

Statistics are something that is always interesting to look at. Especially after spending time in the game!

2025

After 3.5+ years, I changed the logo. I liked the old one quite well, but I decided to redesign it because of the upcoming change in my direction in game development.

What do I mean?

You'll find out soon.

We've updated the trending section of the Game Jolt Shop! http://gamejolt.com/#shop

Snag a new avatar frame and a sticker pack or two!

Remember, every purchase supports our creators and our community!

Support creators, shop on Game Jolt! #broadcast

Game feature reveal - Speedrun mode

This is a level where you not only need to win, but also do it as quickly as possible!

3 difficulty levels - so you can choose the one that is comfortable for you!

2025

We have a question and we wanna know: What's the coolest easter egg you've ever seen in a game? Complete the quest and you'll get 100 Coins!

Initial list of languages ​​planned for support.

Localization turned out to be quite a challenge, but I think it's worth it! After all, it's always comfortable to play a game in your native language, isn't it?

2025

Help wanted!

Animator

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!

Help wanted!

Translator (English -> Hindi)

More information in the article