If bitcoin is illegal on your country , you can still use crypto only online because country or a government rather dont hold the online world , they dont hold bitcoin but its possible that they can ban some sites within their network or within the countries local ip . there are also sites that are illegal online and you can get into some serious trouble if you will insist to use and visit them .
If bitcoin were illegal in the country then you must obey the law with your government because if you have been caught of course you must punishable by them. So, you don't have anything to do if illegal in your country unless you migrate into another place were bitcoin was allowed to use.
If a country bans Bitcoin, it can be interpreted in many different ways. A few examples are:
1. Bitcoin can't be used as a legal tender: In countries such as India, Bitcoin can't be used as a form of payment. But that doesn't mean that the possession of Bitcoin and trading of Bitcoin to fiat is illegal.
2. Bitcoin trading is illegal: In countries such as Bangladesh, you are banned from trading your BTC to fiat. But the possession of BTC as such is not a punishable offense.
3. Possession of Bitcoin is illegal: I don't think any country is having such a rule as of now. It can't be implemented anyway.
What I wanted to say is that the laws should be clear.