The Book of Daniel in the Old Testament contains two of the most well-known Bible stories, which although familiar to most, we'll review for a minute:
(1) Shadrach, Meshach, and Abednago: Servants of King Nebuchadnezzar, they were commanded to bow down and worship a golden idol. They refused, and were cast into a fiery furnace, but were saved by the power of God.
(2) Daniel: A powerful and righteous noble under King Darius, Daniel disobeyed a royal decree not to pray to any God or man other than the King himself, and was cast into a den of lions. He was also saved by the power of God.
There are obvious similarities between the two stories, especially coming one right after the other in the Bible text. The differences, though, may be more worthy of discussion...
The key difference between the stories is that SM&A were commanded to do something bad, while Daniel was commanded NOT to do something good. This is an important distinction: Shadrach, Meshach, and Abednago in their circumstance didn't have many options. Do something against their faith, or be 'executed'.
Daniel, on the other hand, seemingly had more options to choose from. Daniel 6:10 makes clear that Daniel knew about the law, but still chose to pray in an open location where he could be seen, especially by the other nobles who were specifically looking to accuse him for doing so.
Was this a wise choice by Daniel? In Daniel 3:17 we read:
If it be so, our God whom we serve is able to deliver us from the burning fiery furnace, and he will deliver us out of thine hand, O king. (18) But if not, be it known unto thee, O king, that we will not serve thy gods, nor worship the golden image which thou hast set up.
Shadrach and company knew that God could save them from the furnace...but not that He necessarily would. Nevertheless, their choice was made, to their credit. Daniel likewise, surely knew that God could save Him, but not that He for sure would...which raises the question whether Daniel was taking an unnecessary risk by openly praying, when he could have obviously found a way to pray in secret--thereby fulfilling his duty to God, but without disobeying the 'law of the land'
This is a relevant question because there's a similar story in the Book of Mormon that deserves discussion:
From Mosiah 24, where Alma and the early believers were taken captive by Amulon and the Lamanites:
8 -- And now it came to pass that Amulon began to exercise authority over Alma and his brethren, and began to persecute him, and cause that his children should persecute their children.
10 -- And it came to pass that so great were their afflictions that they began to cry mightily to God.
11 -- And Amulon commanded them that they should stop their cries; and he put guards over them to watch them, that whosoever should be found calling upon God should be put to death.
12 -- And Alma and his people did not raise their voices to the Lord their God, but did pour out their hearts to him; and he did know the thoughts of their hearts.
We don't know whether God would have saved them through miraculous means if they had decided to pray openly in violation of Amulon's edict, but it's interesting that they didn't try. They chose (wisely, perhaps?) to 'pour out their hearts' to God, and He would hear them, without being put to death by praying aloud.
Does this show a lack of faith on their part...or simply wisdom? Again, the people of Alma weren't being forced to do something bad, just prevented from (openly) doing something good...which we should note still had a few 'loopholes'.
Things worked out for Daniel, fortunately--if not, I doubt his story would be in the Bible at all--but the question remains: is it better to be bold and let faith (hopefully) carry the day, or adjust to present circumstances and find a way to have your cake and eat it too, as it were?