Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Get dynamic time
- private float _currentTime =
- {
- get
- {
- return SomeClass.SomePublicMethodForCurrentRealTime();
- }
- }
- //A Ternary function (? Operator) to do something like determine day or night
- static bool isDay(){
- return _currentTime < 11.59 ? True : False;
- }
- //some function to tick while isDay is True
- private void ImDoingDaylightStuff()){
- do
- {
- SomeTickFunctions();
- } while (isDay());
- }
- /// The ?? (null coalescing) side of the house will run an operation if null or run another if value is present
- private string _ignoredIfNull = null;
- private string _firedIfNotNull = "I'm Not Null";
- private string SpitOutSomeText()
- {
- return _ignoredIfNull ?? _firedIfNotNull;
- }
- // Output
- "I'm Not Null"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement