Switch statement pulled from the Unity website. I made a few tweaks to get it to output to the console.
using UnityEngine;
using System.Collections;
public class SwitchStatement : MonoBehaviour
{
public int intelligence = 5;
void Greet()
{
switch (intelligence)
{
case 5:
Debug.Log("Why hello there good sir! Let me teach you about Trigonometry!");
break;
case 4:
Debug.Log("Hello and good day!");
break;
case 3:
Debug.Log("Whadya want?");
break;
case 2:
Debug.Log("Grog SMASH!");
break;
case 1:
Debug.Log("Ulg, glib, Pblblblblb");
break;
default:
Debug.Log("Incorrect intelligence level.");
break;
}
}
void Update()
{
Greet();
}
}