How to remain inside a function?

while(i = 1){
  // statement(s)
 }

Should be:

while(i == 1){
  // statement(s)
 }

Ditto to the OP.