idk lol
parent
cd08c8faa0
commit
7cc069d988
|
|
@ -1,6 +1,30 @@
|
|||
void main() {
|
||||
int? a = 5;
|
||||
import 'dart:collection';
|
||||
|
||||
a ??= 3;
|
||||
print(a);
|
||||
void main() {
|
||||
Set<String> bannedWords = {"spam", "scam", "phishing"};
|
||||
var test56 = Set();
|
||||
print(test56.runtimeType);
|
||||
print(bannedWords.runtimeType);
|
||||
|
||||
var test5 = HashSet<int>();
|
||||
test5.addAll([1, 2, 3, 4, 5]);
|
||||
print(test5.elementAt(1));
|
||||
print(test5.runtimeType);
|
||||
print(bannedWords.runtimeType);
|
||||
var test = LinkedHashSet<String>();
|
||||
test.add("test1");
|
||||
test.add("test3");
|
||||
test.add("test2");
|
||||
print(test.runtimeType);
|
||||
|
||||
print(test.elementAt(1));
|
||||
|
||||
bool isClean(String text) {
|
||||
return !text.toLowerCase().split(" ").any(bannedWords.contains);
|
||||
}
|
||||
|
||||
print(isClean("Potentiel gefährlicher Text: scam"));
|
||||
|
||||
var s = Set<int>();
|
||||
print(s.runtimeType);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
void main() {
|
||||
Map<String, int> scoreboard = {};
|
||||
|
||||
var playerOne = "Victor";
|
||||
var scoreOne = 1337;
|
||||
newScore(scoreboard, playerOne, scoreOne);
|
||||
|
||||
var scoreTwo = 420;
|
||||
newScore(scoreboard, playerOne, scoreTwo);
|
||||
|
||||
var scoreThree = 1400;
|
||||
newScore(scoreboard, playerOne, scoreThree);
|
||||
|
||||
print(scoreboard);
|
||||
}
|
||||
|
||||
void newScore(Map<String, int> scoreboard, String name, int score) {
|
||||
var savedScore = scoreboard[name];
|
||||
|
||||
if (savedScore == null) {
|
||||
scoreboard[name] = score;
|
||||
return;
|
||||
}
|
||||
|
||||
if (savedScore < score) {
|
||||
scoreboard[name] = score;
|
||||
return;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue