Created
January 5, 2021 02:10
-
-
Save gavr123456789/28c6577187d8fd3162ab057bb716c1b3 to your computer and use it in GitHub Desktop.
check if all types are the same
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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