forked from JXPorter/OkitaUnity
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample.cs
More file actions
48 lines (44 loc) · 929 Bytes
/
Example.cs
File metadata and controls
48 lines (44 loc) · 929 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using UnityEngine;
using System.Collections;
public class Example : MonoBehaviour
{
public int num = 0;
void Start()
{
if(num > 0)
{
goto MyLabel; // goes to MyLabel
// goto lets you set up labels anywhere in the code block. When used, it sends the software to the line following the label it was told to jump to
}
print("number was less than 0"); // gets skipped if num isn't > 0
MyLabel: // goes here when num > 0
print("I jumped to MyLabel.");
}
void Update()
{
}
}
//// Original Code
//public class Example : MonoBehaviour
//{
// public int num = 1;
//
// void Start()
// {
// if (num > 0)
// {
// goto MyLabel; // goes to MyLabel
// }
//
// print("number was less than 0");//gets skipped if num isn’t > 0
//
// MyLabel: // goes here when num is greater than 0
// print("I jumped to MyLabel");
// }
//
// // Update is called once per frame
// void Update()
// {
//
// }
//}