A constant is a variable which remains fixed for the remainder of the program.
public class MyState {
public static const MODE_VISUAL = 1;
public static const MODE_AUDIO = 2;
public static const MODE_BOTH = 3;
private var mode = MyState.MODE_AUDIO;
private function signalAlarm ( ) {
if (mode == MODE_VISUAL) {
} else if (mode == MODE_AUDIO) {
} else if (mode == MODE_BOTH) {
}
}
}
Related examples in the same category