erlang - How does receive block work? -
i had simple question , can't seem find answer it. question if have function recording state (recursive) , send multiple messages it, keep going through receive block until no longer has messages in "mailbox"? state(fridge) -> receive pat1 -> io:format("ok"), state(s); pat2 -> io:format("not ok"), state(s) end. so if i'd send process 3 messages (pat1, pat2, pat1) using "!" , not able go loop before receiving messages still print out following? 1> "ok" 2> "not ok" 3> "ok" sorry if isn't put, simplifying question might make hard picture asking. your question isn't clear seem asking whether process receive 3 messages if they're sent before target process has called receive — if that's question, answer yes. when send message process, goes process's message queue until process calls r...