Skip to content

Instantly share code, notes, and snippets.

@gavr123456789
Created January 5, 2021 02:10
Show Gist options
  • Save gavr123456789/28c6577187d8fd3162ab057bb716c1b3 to your computer and use it in GitHub Desktop.
Save gavr123456789/28c6577187d8fd3162ab057bb716c1b3 to your computer and use it in GitHub Desktop.
check if all types are the same
bool sus(params Type[] types){
if (types.length != 0){
var a = types[0];
for (var i = 1; i < types.length; ++i){
if (!a.is_a(types[i]))
return false;
else
a = types[i];
}
return true;
}
return false;
}
void main() {
var a = sus(typeof(bool), typeof(bool), typeof(bool), typeof(bool));
var b = sus(typeof(int), typeof(string), typeof(bool));
prin(a, " ", b);
}
[Print]
void prin(string s){
print(s + "\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment