This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
int main() { | |
int a = 1; int b = 2; | |
if ((bool)a != (bool)b) | |
std::cout << "a xor b -> true" << std::endl; | |
else | |
std::cout << "a xor b -> false" << std::endl; | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
v = "global" | |
do | |
print(v) -- "global" | |
local v = "local" | |
print(v) -- "local", of course | |
v = nil | |
print(v) -- nil, not "global" | |
collectgarbage("collect") | |
print(v) -- still nil | |
print (_G.v) -- of course "global" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdexcept> | |
template<typename T> T modulo(T dividend, T divisor) { | |
if (divisor == static_cast<T>(0)) // division by zero is not allowed | |
throw std::domain_error("division by zero"); | |
if (dividend < static_cast<T>(0)) // dividend is negative | |
return -((-dividend) % (-divisor)); | |
else // dividend is non-negative | |
return dividend % divisor; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%define groovy_root_dir /usr/share | |
Name: groovy | |
Version: 2.2.2 | |
Release: 1%{?dist} | |
License: See: http://groovy.codehaus.org/license.html | |
BuildRoot: %{_tmppath}/%{name}-%{version}-build | |
Group: Development/Languages/Groovy | |
Summary: Contains the base system for executing groovy scripts. | |
Source: http://dist.codehaus.org/groovy/distributions/groovy-binary-%{version}.zip |
NewerOlder