# ScrollViewSchool Pt13 UIPageViewController Min(Max?

**URL:** <https://forums.kodeco.com/t/scrollviewschool-pt13-uipageviewcontroller-min-max/23497>\
**Category:** Swift\
**Created:** [November 30, 2016, 4:07am UTC](https://forums.kodeco.com/t/scrollviewschool-pt13-uipageviewcontroller-min-max/23497 "2016-11-30T04:07:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gallaugher](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/gallaugher/32/82512_2.png) [@gallaugher](https://forums.kodeco.com/u/gallaugher)\
**Post date:** [November 30, 2016, 4:07am UTC](https://forums.kodeco.com/t/scrollviewschool-pt13-uipageviewcontroller-min-max/23497/1 "2016-11-30T04:07:35Z")

</div>

I was able to update the Scroll School tutorial for Part 13 to Swift 3 & got it to run. Anyone looking for a working copy, I’ve posted mine on GitHub:  
[https://github.com/gallaugher/Swift3ScrollSchoolPart13](https://github.com/gallaugher/Swift3ScrollSchoolPart13)

There’s one bit that I don’t understand. In the file PagedViewController.swift, the function below:

func tutorialStepForPage(\_ inPage: Int) → TutorialStepViewController {  
let tutorialStep = storyboard!.instantiateViewController(withIdentifier: “TutorialStepViewController”) as! TutorialStepViewController  
let page = min(max(0, inPage), pageCount-1)  
tutorialStep.page = page  
…

if inPage is passed, why can’t we simply:  
let page = inPage  
meaning, why do we need:  
let page = min(max(0, inPage), pageCount-1)

Thanks for helping me understand this!  
John
