<div dir="ltr">Hi,<br><br>You can use a counter in internal state.<br><br>-record(state, { counter=0 }).<br><br>Every time you receive a message counter++<br><br>Erlang pseudocode:<br><br>loop(#state{counter = Counter} = State)  -><br>receive <br>     1 -><br>       if Counter == 0 -><br>             call b;<br><div style="text-align: left;">       true -><br></div>              call c<br>      end,<br>      loop(State#state{counter = Counter + 1})<br>end<br>end<br>Bogdan<br>On Thursday, July 30, 2015 at 11:36:37 AM UTC+3, Ravindra M wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir="ltr">Hi All,<div>          I am new to Erlang(been programming in python and C).</div><div><br></div><div>I have trouble in implementing following program,</div><div>Lets say I have,</div><div>1) function a which receives message in infinite loop.</div><div>2) function a should call function b when first message is received.</div><div>3) call function c when subsequent messages called.</div><div><br></div><div>Lets assume there is no difference between message, example your always receive '1'.</div><div><br></div><div>So first '1', will call function b and all subsequent '1' call function c executed.</div><div><br></div><div>Thanks,</div><div>Ravi</div></div></blockquote></div>