Skip to content

Instantly share code, notes, and snippets.

@tlylt
Last active May 17, 2020 14:49
Show Gist options
  • Save tlylt/addde37e4546a5a079b674dff1f69697 to your computer and use it in GitHub Desktop.
Save tlylt/addde37e4546a5a079b674dff1f69697 to your computer and use it in GitHub Desktop.
Use % 100 to get the last two digits of a number
--- 430 % 100 => 30
Use // 100 to get the first digit of a number
--- 430 //100 => 4
Use % 10 to get the last digit of a number
--- 430 % 10 => 0
Conclusion
- Use //10 to get from the left
//10, remove 1 digit from right
//100, remove 2 digits from right
- Use %10 to get from the right
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment