From the course: Writing Secure Code for Android by Infosec
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Activity: Managing overflows
From the course: Writing Secure Code for Android by Infosec
Activity: Managing overflows
- [Instructor] Understanding overflows. Activity, managing overflows. Go into your activities, go to course three, go to managing overflows and find a little text file called managing overflows snippets. Open it up. We have a number of snippets in here that take us through recursion all the way up to tailrec. We'll get a little more complex each time, but we'll start with a very simple example first so we kind of understand what's going on. Open up a Kotlin Playground and take the first snippet, snippet one, and copy it and paste it in. Now this is a really simple example. We have a main function that starts at the variable A, which is five. The main function then calls the next function called call me and it passes the argument of A. the call me function takes one argument, A, which is an integer, and what it does is it prints A. It has this if statement, if A is greater than zero, call itself and decrement by one, decrement A by one starting with five, then go to four, three, two…