Skip to content

Instantly share code, notes, and snippets.

@bnchdrff
Created July 5, 2017 19:14
Show Gist options
  • Save bnchdrff/2d67c586f6a3118ab0ceda4dc14ff3f7 to your computer and use it in GitHub Desktop.
Save bnchdrff/2d67c586f6a3118ab0ceda4dc14ff3f7 to your computer and use it in GitHub Desktop.
scope in salesforce apex
class FoobarTest {
String bar;
public String messyScope() {
String bar;
bar = 'messy';
return bar;
}
public String messierScope() {
String bar;
bar = 'messier';
return bar;
}
public String messiestScope() {
bar = 'messiest';
return bar;
}
public String upperScope() {
return bar;
}
}
FoobarTest fbt = new FoobarTest();
System.debug(fbt.messyScope()); // messy
System.debug(fbt.upperScope()); // null
System.debug(fbt.messiestScope()); // messiest
System.debug(fbt.upperScope()); // messiest
System.debug(fbt.messierScope()); // messier
System.debug(fbt.upperScope()); // messiest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment