Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 968 online users. » 0 Member(s) | 964 Guest(s) Yandex, Bing, Applebot, DuckDuckGo
|
Latest Threads |
SELECT statement with MS ...
Forum: MS Access SQL Tutorials
Last Post: Qomplainerz
07-27-2023, 03:35 PM
» Replies: 0
» Views: 1,507
|
SELECT statement with the...
Forum: MS Access SQL Tutorials
Last Post: Qomplainerz
07-27-2023, 03:31 PM
» Replies: 0
» Views: 874
|
Creating hyperlinks in HT...
Forum: HTML5 Tutorials
Last Post: Qomplainerz
07-27-2023, 01:23 PM
» Replies: 0
» Views: 1,255
|
What's new in HTML5?
Forum: HTML5 Tutorials
Last Post: Qomplainerz
07-27-2023, 12:48 PM
» Replies: 0
» Views: 942
|
What is HTML5?
Forum: HTML5 Tutorials
Last Post: Qomplainerz
07-27-2023, 12:43 PM
» Replies: 0
» Views: 846
|
Neck isometric exercises
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:44 AM
» Replies: 0
» Views: 1,198
|
Shoulder shrug
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:43 AM
» Replies: 0
» Views: 769
|
Neck retraction
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:43 AM
» Replies: 0
» Views: 754
|
Neck flexion and extensio...
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:42 AM
» Replies: 0
» Views: 857
|
Neck rotation
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:42 AM
» Replies: 0
» Views: 820
|
|
|
Checking if a number is odd or even in Ruby |
Posted by: Qomplainerz - 02-28-2021, 08:28 AM - Forum: Ruby 3 Tutorials, exercises and examples
- No Replies
|
 |
Example 1.
Let's see if 1 is even by executing the following code:
Quote:puts 1.even?
This will print "false" on the screen, because 1 is not even.
Example 2.
Let's see if 2 is even by executing the following code:
Quote:puts 2.even?
This will print "true" on the screen, because 2 is even.
Example 3.
Let's see if 1 is odd by executing the following code:
Quote:puts 1.odd?
This will print "true" on the screen, because 1 is odd.
Example 4.
Let's see if 2 is odd by executing the following code:
Quote:puts 2.odd?
This will print "false" on the screen, because 2 is not odd.
|
|
|
Galaxia |
Posted by: Qomplainerz - 02-27-2021, 11:33 AM - Forum: Archived posts
- No Replies
|
 |
Patch Notes: - 0.4:
- Revamped combat game. Feedback appreciated!
- Time Boost added to research options
- Explored planets displayed in UI
- Colony ships no longer grant science
- Console reports colony ships granting power
- Power no longer used by disabled factories
- Mini-icons updated to match buttons
- 0.3.1:
- Fixed issue where higher multiplier colony ship purchases weren't costing the correct amount
- Disabled cheat keys in published builds
- Fixed incorrect draw order of the configure/console
- Improved legibility of "hostiles detected"
- Sound: Off setting respected on refresh
- Show a warning overlay when out of probed planets to colonize
- Display factory counts
- Added toggle factory button for factory types (replaces r-click)
- Added a bunch of new sound effects
- 0.3.0:
- New interface
- Hostiles/Fighters
- 0.2.0:
- Save games (and reset).
- Artifacts.
- 0.1.0:
- Added power. Mines and Factories require power.
- Re-tuned many values.
- Right click a production button to disable production of that item and all factories^n of that item.
- 0.0.2:
- Fixed bug when building factory^n.
- Buttons have pressed and mouseover states, click sounds.
- Costs now have min 2 sig figs.
- Factories now tick every 1/10th of a second (like mines).
- 0.0.1:
- Fixed bug where you could be unable to build probes.
- Most numbers displayed in a fixed width font with delimeter.
- Suffixes for costs now go to T (trillion), Q and beyond.
- Many actions and results now displayed when they occur. Example "Probe arrived: +1{science icon}"
- 0.0.0:
- Direct copy of the LD31 version to the new site
You can play the latest version of the game here
|
|
|
Quotients and remainders in Ruby |
Posted by: Qomplainerz - 02-27-2021, 08:51 AM - Forum: Ruby 3 Tutorials, exercises and examples
- No Replies
|
 |
After reading the official Ruby 3.0.0 documentation I have discovered another cool thing.
Let's assume we want to get the result of 11 / 3 and declare some variables as follows:
Quote:Num1 = 11
Num2 = 3
Quotient = Num1 / Num2
puts "Quotient: " + Quotient.to_s
This will print 3 on the screen.
Now let's get the remainder of the division as follows:
Quote:Option 1:
Num1 = 11
Num2 = 3
Remainder = Num1 % Num2
puts "Remainder: " + Remainder.to_s
Option 2:
Num1 = 11
Num2 = 3
Remainder = Num1.remainder(Num2)
puts "Remainder: " + Remainder.to_s
Both will print 2 on the screen.
And then let's put the quotient and the remainder together as follows:
Quote:Num1 = 11
Num2 = 3
Quotient = Num1 / Num2
Remainder = Num1 % Num2
Quotient_Remainder = "#{Quotient}, #{Remainder}"
puts "Quotient and remainder: " + Quotient_Remainder.to_s
This will print 3, 2 on the screen.
And now the cool thing.
When using the divmod function Ruby will calculate the quotient and the remainder at the same time.
Quote:Num1 = 11
Num2 = 3
Quotient_Remainder = Num1.divmod(Num2)
puts "Quotient and remainder: " + Quotient_Remainder.to_s
This will print [3, 2] on the screen.
|
|
|
Executing Ruby in a Linux terminal |
Posted by: Qomplainerz - 02-27-2021, 07:28 AM - Forum: Ruby 3 Tutorials, exercises and examples
- No Replies
|
 |
I have discovered a little inconvenience when trying to execute Ruby from the Linux terminal with a friend.
The Linux version of Ruby doesn't offer the interactive ruby shell,
so if you want to execute Ruby codes from the built in Linux terminal you have to do the following:
1. Open the terminal
2. Write some Ruby code in it
3. Save the file i.e. as example.rb
4. Open the file from the terminal
|
|
|
The difference between print and puts |
Posted by: Qomplainerz - 02-26-2021, 08:28 AM - Forum: Ruby 3 Tutorials, exercises and examples
- No Replies
|
 |
Print will print whatever you have in one line on the screen, even if there are multiple lines in your code.
For example:
Quote:print 1 + 2
print 2 + 3
This will print the results 3 5 in one line on the screen.
Puts will print whatever you have in a new line on the screen.
For example:
Quote:puts 1 + 2
puts 2 + 3
This will print the results
3
5
in two lines on the screen.
|
|
|
Getting started with Ruby 3 |
Posted by: Qomplainerz - 02-26-2021, 07:34 AM - Forum: Ruby 3 Tutorials, exercises and examples
- No Replies
|
 |
Actually there are several ways to get started with Ruby 3.
1. Testing Ruby online
You can type some Ruby code and run it online here.
Version 2.5.1. isn't the latest Ruby version,
but since it's online you don't need to install anything
and it runs on all kinds of devices.
2. Testing Ruby with an IDE
To test Ruby with an IDE you should download the latest Ruby version here.
Please follow the installation instructions to install Ruby either on Windows, Mac or Linux.
Once Ruby is installed correctly you can download a small, lightweight and free IDE here.
Now click on "File" > "New" > file.rb to create a new Ruby file.
You can delete the automatically generated Ruby code and add your own.
Then save it i.e. as untitled.rb and click on the "execute" button to run it.
This way you should have the latest Ruby version (currently 3.0.0),
you can use syntax highlighting, code completion or other cool things,
but you'll have to download and install it on your device.
3. Testing Ruby in the interactive ruby shell
If you have decided for step 2 you can also run Ruby codes in the interactive ruby shell that was installed on your device.
On Windows click on "Click here to search" and type "Interactive Ruby" there.
For Mac or Linux please read the Ruby documentation on how to open it there instead.
Now you can directly write some code and execute it without saving it first.
This way you will also have the latest Ruby version (currently 3.0.0).
It also requires an installation on your device.
There is no syntax highlighting, code completion etc.
|
|
|
|