if true {
print("This statement gets executed when condition is true")
}
vs.
guard true else {
using System; | |
using UnityEngine; | |
using UnityEngine.UI; | |
using OneSignalSDK; | |
public class ExampleBehaviour : MonoBehaviour | |
{ | |
public OSConfigData configData; | |
public string externalId; |
import * as React from 'react'; | |
import { APP_ID } from '@env'; | |
import { OneSignal} from 'react-native-onesignal'; | |
class OS extends React.Component<Props, State> { | |
constructor(props: Props) { | |
super(props); | |
this.state = { }; | |
} |
import SwiftUI | |
import DotEnv | |
import OneSignalFramework | |
@main | |
struct MyApp: App { | |
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate | |
var body: some Scene { | |
WindowGroup { |
import 'package:flutter/material.dart'; | |
import 'package:onesignal_flutter/onesignal_flutter.dart'; | |
import 'package:flutter_application_la/live_actiivties_manager.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); |
if true {
print("This statement gets executed when condition is true")
}
vs.
guard true else {
func greetingMaker(greeting: String) -> (String) -> String {
return {
"\(greeting), \($0)"
}
}
let hello = greetingMaker(greeting: "Hello")
hello("world") // "Hello, World"
#!/bin/sh | |
rm -rfv .vscode ~/Library/Application\ Support/Code ~/Library/Caches/com.microsoft.VSCode ~/Library/Saved\ Application\ State/com.microsoft.VSCode.savedState |
void main() { | |
late String s = superCostlyInitializer(); // `s` is not initialized yet | |
print(s); // `s` is initialized now that it's needed | |
} | |
String superCostlyInitializer() { | |
return "A lot of work went into initializing this result"; | |
} | |
Using Dart's format
command enables you to format all dart files in a project. Setting the --set-exit-if-changed
flag will cause the formatter to return an exit code that can be used in CI to pass or fail a build.
$ dart format -o none --set-exit-if-changed
void main() { | |
var middleName = middle("iAmWillShepherd"); | |
middleName ??= "This assignment won't happen."; | |
print(middleName); // Logs 'S' in the console | |
var noMiddle = middle("No middle exists"); | |
noMiddle ??= "This assignment will happen."; | |
print(noMiddle); // This assignment will happen. | |
} |